I'm trying to deserialize and parse a JsonObj
{ "obj": [
{
"name": "Kelly",
"calculation": {
"reff" : "apply(stringa/stringb)"
},
"value": "Number",
}
]
}
string jsonString = JsonConvert.SerializeObject(jsonObj);
JObject parsedObj = JObject.Parse(jsonString );
var reffTokens = parsedObj.SelectTokens("$..reff");
foreach (JToken token in reffTokens.ToArray())
{
var calculatedToken = parsedObj.SelectToken(token.ToString());
}
I get this error:
Newtonsoft.Json.JsonException
HResult=0x80131500
Message=Unexpected character while parsing path indexer:
Source=Newtonsoft.Json
If I remove the braces and have the calculation part as
"calculation": {
"reff" : "stringa/stringb"
},
then it works fine. any suggestion on how to deserialize and parse JObject for parentheses? Thanks!
User contributions licensed under CC BY-SA 3.0