Is there a JSON equivalent of XQuery/XPath?

Naftuli Kay picture Naftuli Kay · Dec 12, 2011 · Viewed 113.5k times · Source

When searching for items in complex JSON arrays and hashes, like:

[
    { "id": 1, "name": "One", "objects": [
        { "id": 1, "name": "Response 1", "objects": [
            // etc.
        }]
    }
]

Is there some kind of query language I can used to find an item in [0].objects where id = 3?

Answer

Mike Christensen picture Mike Christensen · Dec 12, 2011

Yup, it's called JSONPath. The source is now on GitHub.

It's also integrated into DOJO.