Live data from Hacker News

JMESPath – A query language for JSON

jmespath.org

1–10 of 131 posts

Re: JMESPath – A query language for JSON

#7
post #3

This 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

#8

The 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

#9

The 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.
Post reply on HN