public enum Animals {
Chihuahua,
Kitten,
Llama,
Elephant,
Badger,
Mushroom
}So let us assume I have an object that accepts this type as a property. So far so good. public class Cage {
public Animal Animal { get; set; }
}(This is a fake example of course).var cage = new Cage {
Animal = Animal.Mushroom
}Appears in Raven's management UI like this.{
"Animal" : "Mushroom"
}But when I do a deserialize and convert it to JSON using the following code...I get the following output.../// <summary> /// Allows for any object to be serialized into Json very quickly. /// </summary> public static class JsonExtensions { /// <summary> /// Serializes an object to Javascript Object Notation. /// </summary> /// <param name="item">The item to serialize.</param> /// <returns> /// The item serialized as Json. /// </returns> public static string ToJson(this object item) { return Newtonsoft.Json.JsonConvert.SerializeObject(item); } }
{
"Animal" : "5"
}I actually want to store them as strings. I just wanted to make sure that if I rearrange them or add new values it won't break. If it stores as strings, then I can't see why it would break.