I have some Json which seems perfectly valid when ran in JavaScript but fails when I try to parse it using Newtonsoft.parse in c#. I get the error parsing boolean value. I'm guessing newtonsoft doesn't like none string values which aren't integers or booleans.
in JavaScript:
var formDef = { "control" : formDef["c1"], "c1" : "Button" }
in c#:
JObject.Parse("{\"control\":formDef[\"c1\"],\"c1\":\"Button\"}")
Many thanks.
I have some Json which seems perfectly valid when ran in JavaScript but fails when I try to parse it using Newtonsoft.parse in c#. I get the error parsing boolean value. I'm guessing newtonsoft doesn't like none string values which aren't integers or booleans.
in JavaScript:
var formDef = { "control" : formDef["c1"], "c1" : "Button" }
in c#:
JObject.Parse("{\"control\":formDef[\"c1\"],\"c1\":\"Button\"}")
Many thanks.
Share Improve this question asked Feb 23, 2016 at 16:27 SaipH-SaipH- 51 silver badge4 bronze badges 1- I'd say similar, not dupicate, the linked question presents a serialization problem in addition of the deserialization one – Irwene Commented Feb 23, 2016 at 16:39
1 Answer
Reset to default 3formDef["c1"]
is valid Javascript, not valid JSON. Try running your JSON through a linter to know if it's valid.
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745464598a4628860.html
评论列表(0条)