Search code examples
jsonsyntaxjsonpath

json query and json path


I try not to make this a loaded question, but a quite focused one instead --

when talking about processing JSON data, I thought people have converged, from different fancy ways to query json structures, to just JSONPath, AKA JPath, "proposed by Stefan Goessner allows for XPath-like expressions to be evaluated against JSON".

At least I thought so, until I take a closer look today at the syntax of jq, which looks quite similar to JPath, but actually different, and more advanced.

So, my question is, any one knows where its syntax is coming from (as jq doesn't say so on its web site)?

Further, it doesn't say what jq stands for either. So let me assume it stands for "json query". So the next question is, of all json query tool listed in jsonquerytool.com, (i.e., JSONPath, JSPath, Lodash, Underscore, JPath, XPath for JSON, JSON Pointer and just plain old JavaScript),

json query tool

whose syntax are closer to JPath, and whose are closer to jq, or their syntax are just "all-over-the-places", i.e., each are quite different from others.


Solution

  • Your answer to this question is "all-over-the-places". There must be dozens of JSON Query languages proposed and implemented now. jq is very popular in Data Science. It also has an online sandbox at https://jqplay.org/

    I was unaware of recent clampdown on SO questions so I asked a general Q about this topic and got shut down. No surveys, no off site refs allowed. JSON Query in 2018: most used languages?

    Stack-O data science geeks ought to try a tally up and report of the JSON Query languages. Right now it's the wild kingdom.

    2 others not on your list are JSONiq and XPath 3.1. Xpath (along with XQuery) is a W3 standard. JSON was created in part as a lean replacement for XML so I think they are nearly isomorphic so far as data structures.