SelectToken () with space in path

I recently upgraded from Json.Net 50r6 to 60r6. Consider the following json:

{
    "room list": {
        "regular": [
            {
                "single": {
                    "beds": 1,
                    "bedtype": "double",
                    "balcony": "no"
                }
            }, {
                "double": {
                    "beds": 2,
                    "bedtype": "double",
                    "balcony": "no"
                }
            }
        ]
    }
}

      

In 50r6, this piece of code works correctly:

    Dim j As JObject = JObject.Parse(line)

    Dim jt As JToken = j.SelectToken("room list")

      

In 60r6, I get the error:

"Unexpected character while parsing path:"

This is mistake? The problem is solved in 60r6 if I change the json method SelectToken()

to "list of rooms" too .

Edit: I also get the same error with SelectToken()

if the passed parameter contains parentheses.

+3


source to share


1 answer


Change it to:



Dim jt As JToken = j.SelectToken("['room list']")

      

+3


source







All Articles