forgive my poor english
for example:
A java enum like
1
2
3
4
5
6
7
8
9
10
11
|
public enum SomeTypeEnum {
A(0),B(1),C(2);
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
1
2
3
4
5
6
7
8
9
10
11
12
|
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
public enum SomeType
{
A=0,B=1,C=2
}
public class SomeTypeTest
{
[JsonConverter(typeof(StringEnumConverter))]
public SomeType someType {get;set;}
}
|
it’s OK whatever do deserializing or serializing, nothing else should be care, just do it!!