5 ms·
Here's the real JSONPath: https://goessner.net/articles/JsonPath/ https://goessner.net/articles/JsonPath/ This submission is for PostgreSQL's "JSON Path", whi
by cle 7y ago
Here's the real JSONPath:
https://goessner.net/articles/JsonPath/ https://goessner.net/articles/JsonPath/
This submission is for PostgreSQL's "JSON Path", which is very similar to the original JSONPath. I'm surprised, and disappointed, that there is no mention of the original JSONPath, which this is obviously inspired by.
- aasasd 7y agoSo, what I'm seeing is that I currently have JQ, and if I get around to dealing with Postgre, I might also have SQL's JSONPath. And then if I get tired of juggling objects/dicts/arrays in my programs, I can also pick a not-quite-the-same JSONPath as a lib. (Though the latter is unlikely, since Lisp and FP have taught me that a bunch of functions feeding into each other will do exactly the same thing quite fine.)
- neilv 7y agoOleg Kiselyov's SXPath work shows XPath as combinators, in Scheme. John Clements's packaging of SXPath for Racket might be the most accessible way to first look at it: https://docs.racket-lang.org/sxml/sxpath.html https://docs.racket-lang.org/sxml/sxpath.html Then Kiselyov's original writings: http://okmij.org/ftp/Scheme/xml.html#SXPath http://okmij.org/ftp/Scheme/xml.html#SXPath Before Web browsers had nice developer tools in them, I made a little aid for crafting SXPath queries, for HTML scraping: https://www.neilvandyke.org/racket/webscraperhelper/ https://www.neilvandyke.org/racket/webscraperhelper/
- Terretta 7y agoDon’t forget JMESPath, as built into AWS CLI: http://jmespath.org/ http://jmespath.org/ With language libraries or as jp CLI: http://jmespath.org/libraries.html http://jmespath.org/libraries.html Example AWS CLI tricks: https://gist.github.com/magnetikonline/6a382a4c4412bbb68e33e137b9a74168 https://gist.github.com/magnetikonline/6a382a4c4412bbb68e33e... https://opensourceconnections.com/blog/2015/07/27/advanced-aws-cli-jmespath-query/ https://opensourceconnections.com/blog/2015/07/27/advanced-a...
- kapilvt 7y agoJmespath is also built in to the azure cli
- theamk 7y agoWell, they say that they did not invent it, they have just implemented it as defined in ISO/IEC 9075:2016 standard [0] It is entirely possible that ISO design is based of Goessner’s work, but unfortunately it is just history at this point. Unfortunately this is what standardization often does - the work becomes attributed to organization, and individual authors are forgotten. [0] https://modern-sql.com/blog/2017-06/whats-new-in-sql-2016 https://modern-sql.com/blog/2017-06/whats-new-in-sql-2016
- dang 7y agoOk, we've added Postgres above.
- chrismorgan 7y agoAlso of interest is RFC 6901, JSON Pointer, https://tools.ietf.org/html/rfc6901 https://tools.ietf.org/html/rfc6901. That spec is much simpler (and syntactically incompatible, I may add), providing unique paths to elements inside a JSON document, and not handling any sorts of queries, as these Jsonpath and JSONPath things both do. JSON Pointer is not ubiquitous by any means, but it does got use in diverse APIs. Most recently, JMAP uses it for backreferences. (The naming of these things is a mess. XPath deals in what you could call queries or selectors, not what I would be willing to call paths; JSONPath adopted XPath’s bad name presumably for marketing reasons, and so what became RFC 6901 presumably went with the name JSON Pointer instead of the obvious name of JSON Path to avoid confusion, as it was coming well after JSONPath.)