parsing an enumeration in JSON.net

According to JSON.NET documentation, default behavior is to use int value for Enums : http://james.newtonking.com/projects/json/help/SerializationGuide.html

You can change that by adding a JsonConverter attribute with StringEnumConverter on your enum…

/// <summary>
/// The geometry type.
/// </summary>
[DataContract]
[JsonConverter(typeof(StringEnumConverter))]
public enum GeometryType

Documentation: Serialize with JsonConverters

Leave a Comment