javascript - Newtonsoft Json.net error parsing boolean value - Stack Overflow

I have some Json which seems perfectly valid when ran in JavaScript but fails when I try to parse it us

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
Add a ment  | 

1 Answer 1

Reset to default 3

formDef["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条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信