I have json that looks like this:
myjson = {"queries":{"F.SP": 27}}
therefore using
queryResults = JObject.Parse(jsonString)
I can do
firstToken = queryResults.SelectToken("queries")
and return LinqJToken
{"F.SP": 27}
but i'm stuck because when i try
subToken = firstToken.SelectToken("F.SP")
I get nothing. I assume this is because JSON.net is looking for the "F" token with the subtoken "SP".
I also tried each of the following, to no avail
myToken = queryResults.SelectToken("queries.F.SP")
myToken = queryResults.SelectToken("queries[0].F.SP")
(queryResults.SelectToken ("queries [0]") returns nothing, fwiw)
Any ideas?
EDIT: I checked that the built-in "." This is problem; if i change the original json to
{"queries":{"FSP": 27}}
I can do
queryResults.SelectToken("queries").SelectToken("FSP")
no problems
davej source
share