Y is my object being serialized in a weird manner while using newtonsoft.json
from ASP.Net Web API?
var s = JsonConvert.SerializeObject(request, For
I doubt you are still seeking an answer, but my workaround was to create a JObject with Newtonsoft and pass that.
Either:
JObject jBytes = Object.Parse(JsonConvert.SerializeObject(myObject, MyDateTimeFmtString);
or
JObject jBytes = JObject.FromObject(myObject, MyJsonSerializer);
The first case was my second choice, but I think there is a bug in Newtonsoft where JObject.FromObject ignores the DateFormatString in JsonSerializer.
There's nothing to be worried about here. This is the correct serialized object json. It is appearing like this because you are viewing this in visual studio by hovering variable to view its value, because in c# \" is used to represent a " in a string. When you will write this value in a text file(just to test actual value) , you will see what is it's actual value as:
string json="{\"head\":{\"version\":\"1.0\",\"serial\":\"20140102,6,125\",\"skinId\":\"Test\"";
File.WriteAllText("c:\\tests on.txt",json) ;
You will see the json in file what you actually want.
It's because you have serialized it twice, can you post more of your code or skip calling SerializeObject completely