JMESPath – A query language for JSON
jmespath.org
JMESPath – A query language for JSON
1–10 of 131 posts
Re: JMESPath – A query language for JSON
#2Thanks for taking the time to write this tool. Can you explain how it is distinguished from jq?
Re: JMESPath – A query language for JSON
#3This looks interesting - but doesn't MongoDB basically achieve the same effect? I kind of prefer MongoDB because you query JSON with JSON - but I'm open to changing my mind :)
Re: JMESPath – A query language for JSON
#4May also be interested in the `jq` CLI, which on first glance appears to use a similar but not identical query language. https://stedolan.github.io/jq/
Re: JMESPath – A query language for JSON
#5The example on the front page seems equivalent to (and only marginally less verbose than):
locations
.filter(l => l.state === 'WA')
.map(l => l.name)
.sort()
.join(', ')Re: JMESPath – A query language for JSON
#6why choose this over jsonpath (like xmlpath) or jq?
Re: JMESPath – A query language for JSON
#7This looks interesting - but doesn't MongoDB basically achieve the same effect? I kind of prefer MongoDB because you query JSON with JSON - but I'm open to changing my mind :)
If you're using MongoDB already, then sure use MongoDB's query tools. But if you are just working with raw JSON from a potential variety of sources, or in a streaming context, then you need something more in-place and general-purpose, which this appears to be.
Re: JMESPath – A query language for JSON
#8The example on the front page seems equivalent to (and only marginally less verbose than): locations .filter(l => l.state === 'WA') .map(l => l.name) .sort() .join(', ')
I'm guessing the point is to be a common type of query language that can be used from any number of other languages: http://jmespath.org/libraries.html
In at least some languages if these queries can be used without deserializing into a native data structure and then serialized back into a string, this could be a major win.
Re: JMESPath – A query language for JSON
#9The example on the front page seems equivalent to (and only marginally less verbose than): locations .filter(l => l.state === 'WA') .map(l => l.name) .sort() .join(', ')
Your example however will not support dynamic or user-configurable paths without eval(). Alternatively, instead of eval you could run expressions through a JS parser, but it'll be more code than your example. The library we're discussing also defines a grammar for the query language.
Re: JMESPath – A query language for JSON
#10jq exists, is fast, and works well. Is this compatible?