SaipH-
SaipH-

Reputation: 5

Newtonsoft Json.net error parsing boolean value

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.

Upvotes: 0

Views: 8408

Answers (1)

Mike Cluck
Mike Cluck

Reputation: 32511

formDef["c1"] is valid Javascript, not valid JSON. Try running your JSON through a linter to know if it's valid.

Upvotes: 3

Related Questions