JObject.Parse (jsonString) causes a problem for boolean data. e.g. Json:
{ "BoolParam": true }
I used the following code for parsing:
JObject data = JObject.Parse(str1); foreach (var x in data) { string name = x.Key; Console.Write(name + " ("); JToken value = x.Value; Console.Write(value.Type + ")\n"); Console.WriteLine(value); }
This value is output as: BoolParam (Boolean): True
Case sensitivity is causing a problem as I save this json for later use. Saved json looks like
{ "BoolParam": true }
However, when I use it later, JObject.Parse (str) throws an error as invalid Json: Unexpected character encountered while parsing the value: T. Path 'BoolParam', line 2, position 15.
If I changed the case from "True" to "true", it works. I do not want to add this hack to change the case when saving, but is there a better way to handle this scenario.
surya
source share