Javascript – JSON equivalent of XQuery/XPath

javascriptjsonxpathxquery

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?

Best Answer

Yup, it's called JSONPath:

It's also integrated into DOJO.