Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Matching properties with reserved names #17

Closed
chrismytton opened this Issue · 4 comments

2 participants

Chris Mytton Lloyd Hilaiel
Chris Mytton

I am testing JSONSelect against some activity streams json. The activity streams specification defines an object property in the json.

When I try to match the selector .object .objectType I am getting string required after ..

It seems that object is a reserved word for type selectors. I'm hoping a change to this regular expression will solve the problem, but I'm not sure what?

Lloyd Hilaiel
Owner

You may use quotes around property names to both force them to be interpreted as strings and to include chars like spaces and control chars that are allowable by the json spec:

."object" .objectType

Going to leave this open though, it seems like the js parser could disambiguate given context.

Chris Mytton

Awesome! Thanks for the quick response.

Also worth noting that it seems that the same error occurs when the reserved name is used as part of the property name, so your example would have to be written as:

."object" ."objectType"
Chris Mytton

Actually I'm getting invalid json string when using the above selector? Not sure if that is related to the previous issue though?

This selector also gives the same error:

."name" ."first"
Lloyd Hilaiel
Owner

oh, that's no good. I'll add a test or two and check it out...

Lloyd Hilaiel lloyd closed this in e3ce679
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.