Newtonsoft.Json using StringEnumConverter to make it compatiable with enum type

Dec 19, 2016 23:07 · 85 words · 1 minute read

forgive my poor english for example: A java enum like

public enum SomeTypeEnum {

    private int value;
    SomeTypeEnum(int value){
      this.value = value;
    public int getValue(){
      return value;

may be map to


then it can only be deserialized to string Type

however when we do this

using Newtonsoft.Json;
using Newtonsoft.Json.Converters;

public enum SomeType
public class SomeTypeTest
    public SomeType someType {get;set;}

it’s OK whatever do deserializing or serializing, nothing else should be care, just do it!!