Using Newtonsoft Json.Net (11.0.2) with the StringEnumConverter seems to work most of the time but sometimes we get a Json array with numbers in it that do not correspond to the array. Does anyone know how this may be happening?
I have tried setting up tests to simulate the strange output but it works as expected every time. I am thinking that maybe there is a memory issue that causes strange behavior since we only see this occasionally in production.
So we configure our serializer settings with StringEnumConverter and use the following enum as an example:
public enum TestType
{
FirstOption,
SecondOption,
ThirdOption
}
var example = new List<TestType>() { TestType.FirstOption, TestType.SecondOption };
That is an example of the expected output
[
"FistOption",
"SecondOption"
]
This is the output we get most of the time, however, in production we get
[13]
The enum does not have 13 items in it so how does it generate 13? Is there some binary encoding?