Live data from Hacker News

JMESPath – A query language for JSON

jmespath.org

101–110 of 131 posts

Re: JMESPath – A query language for JSON

#102
post #94

Earlier quoted context omitted.

> * Keep that schema file updated by hand every time something like Sudan breaking in two happens (no). There is a lot of use for libraries dealing with time and dates. When you want to cover all cases, at some point you get to the situation when you have to allow variable number of seconds in a minute - not always 60, but sometimes 59 or 61, or may be even different numbers. And you don't know in advance - for arbit…

Ideally, use a library that intelligently parses dates as part of a turing complete validator.

The point is that you can't always avoid scenarios with keeping something updated. List of countries is another example.

Re: JMESPath – A query language for JSON

#103

The reinvention of XML in JSON is almost complete - JMESPath vs XPath, JSON Schema vs XML Schema etc. If you need semi structured data to that level, consider using XML instead - you can validate it, there's plenty of tools, it's very stable and mature etc

jq is a better XPath/XSLT. It's been for a long time now.

(Fair discloure: I'm a jq maintainer.)

Re: JMESPath – A query language for JSON

#104

Besides's this projects cli, jp ( https://github.com/jmespath/jp ), I see jl ( https://github.com/chrisdone/jl ) and jq ( https://github.com/stedolan/jq/ ) in the comments. I wonder if anyone has had experience with all three (or even just one) and can comment on their experiences?

I've used jq and jp/JMESPATH quite a bit. I love jq, and use it more often than JMESPATH. However, recently I've noticed that I arrive at "the solution" I need more quickly with JMESPATH. In retrospect, JMESPATH's documentation and examples have been more useful for me than jq's (docs/examples).

jq has a community wiki. We really should rewrite the docs at some point and/or add lots of examples, as the language has grown quite a lot.

Re: JMESPath – A query language for JSON

#105
post #81

Besides's this projects cli, jp ( https://github.com/jmespath/jp ), I see jl ( https://github.com/chrisdone/jl ) and jq ( https://github.com/stedolan/jq/ ) in the comments. I wonder if anyone has had experience with all three (or even just one) and can comment on their experiences?

jq is by far the best developed and has the most intuitive syntax, but it doesn't have a formal spec for its language. I have been maintaining https://github.com/kislyuk/yq , which wraps jq with a transcoder for YAML and XML.

Is there demand for a formal spec for jq? Would that lead to additional implementations? Serious question.

Re: JMESPath – A query language for JSON

#107

The reinvention of XML in JSON is almost complete - JMESPath vs XPath, JSON Schema vs XML Schema etc. If you need semi structured data to that level, consider using XML instead - you can validate it, there's plenty of tools, it's very stable and mature etc

Exactly. I'll stick with XML, XPATH, and XSLT - thank you very much. Is standards-based, natively-implemented, and super-fast. If a web services sends me JSON, the first thing I do is serialize it to XML.

Re: JMESPath – A query language for JSON

#108
post #43

The reinvention of XML in JSON is almost complete - JMESPath vs XPath, JSON Schema vs XML Schema etc. If you need semi structured data to that level, consider using XML instead - you can validate it, there's plenty of tools, it's very stable and mature etc

Hm. One reason why I prefer Json to XML (and I actually like XML) is, that JSON is simpler. The fact that XML has schema definitions out of the box, and that these schema definitions can reference other definitions would lead to more complex parsers that can contain more bugs and vulnerabilities.

> would lead to more complex parsers that can contain more bugs and vulnerabilities.

Partially yes, but it's also at least in part due to a "fuck all this language theory crap, lets just standardize something already" approach.

Re: JMESPath – A query language for JSON

#109
post #88

Earlier quoted context omitted.

We still need XSLT for JSON to complete the circle. Though it seems like XSLT should support JSON: https://www.w3.org/TR/xslt-30/#json

XML Stylesheet Transformation, the language to describe transformations of XML documents into another XML documents. Isn't jq or JMESPath an example of such a language for transformations?

No, those are query languages akin to XPath.

Re: JMESPath – A query language for JSON

#110
post #81

Earlier quoted context omitted.

jq is by far the best developed and has the most intuitive syntax, but it doesn't have a formal spec for its language. I have been maintaining https://github.com/kislyuk/yq , which wraps jq with a transcoder for YAML and XML.

Is there demand for a formal spec for jq? Would that lead to additional implementations? Serious question.

I would love to have a jq lib in every lang, which would probably require a spec
Post reply on HN