json.net SelectToken with embedded "."
json.net
Solution
This won't return the token itself, but will return the value (which is probably what you're looking for anyway)...
queryResults.SelectToken("queries").Value<int>("F.SP");
Problem
I have json that looks like: ``` myjson = {"queries":{"F.SP": 27}} ``` so with ``` queryResults = JObject.Parse(jsonString) ``` I can do ``` firstToken = queryResults.SelectToken("queries") ``` and get back the LinqJToken ``` {"F.SP": 27} ``` but I'm then stuck, because when I try ``` subToken = firstToken.SelectToken("F.SP") ``` I get Nothing. I'm guessing this is because JSON.net is looking for a token "F" with subtoken "SP". I've 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 have verified that the embedded "." is the problem; if I change the original json to ``` {"queries":{"FSP": 27}} ``` I can do ``` queryResults.SelectToken("queries").SelectToken("FSP") ``` no problem