News for hackers. Stuff that matters.
Re:JMESPath – A query language for JSON by johnhenry on Saturday February 17, 2018 @10:24AM (#16401055)
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?
Re:JMESPath – A query language for JSON by vthriller on Saturday February 17, 2018 @10:54AM (#16401181)
I only have used jq, but I noticed that even AWS CLI docs [0] (already mentioned in the comments a couple of times) suggest to use jq for "more advanced features that may not be possible with --query".

[0] https://docs.aws.amazon.com/cli/latest/userguide/controlling...

Re:JMESPath – A query language for JSON by ak217 on Saturday February 17, 2018 @11:51AM (#16401456)
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.

Re:JMESPath – A query language for JSON by cryptonector on Saturday February 17, 2018 @03:00PM (#16402417)
Is there demand for a formal spec for jq? Would that lead to additional implementations? Serious question.
Re:JMESPath – A query language for JSON by llimllib on Saturday February 17, 2018 @04:12PM (#16402726)
I would love to have a jq lib in every lang, which would probably require a spec
Re:JMESPath – A query language for JSON by cryptonector on Sunday February 18, 2018 @11:25PM (#16410742)
That's fair.
Re:JMESPath – A query language for JSON by wryun on Saturday February 17, 2018 @02:44PM (#16402344)
jq has a more polished CLI and can do 'everything'.

jmespath is more limited, but is well specified and easier to fit in your head. It's also much more appropriate for using as a library from other projects, since it has clean implementations in many languages. It's also an advantage in this case that it can't do everything, since you can more realistically provide untrusted user input.

jmespath's default (Go) CLI isn't as fully featured as jq, unfortunately.

Re:JMESPath – A query language for JSON by zero_intp on Saturday February 17, 2018 @10:44AM (#16401140)
I use jq on simple projects and to prototype. It is lightweight, fast, and usually consistent in operation.
Re:JMESPath – A query language for JSON by fiatjaf on Saturday February 17, 2018 @01:08PM (#16401824)
Apparently JMESPath is a better JSONPath/dot-notation alternative for querying JSON, while jq and jl are full-featured fully functional programming languages that happen to use JSON as their underlying data type.

I had never heard of jl before, but I've recently compiled an "awesome" collection of jq tools, libraries and use-cases at https://github.com/fiatjaf/awesome-jq that may be worth checking out.

Re:JMESPath – A query language for JSON by gregmac on Saturday February 17, 2018 @10:57AM (#16401193)
I've been using jq quite a bit with AWS CLI inside various bash scripts. It allows manipulation and filtering the native api doesn't, which makes it pretty straight forward to get certain values - such as specific tags on the current instance (converted to key-value form, or to turn into bash variables), a list of other systems in the current auto scaling group, etc.

I've also started using it just to get colorized/formatted output from curl or a local json file.

    cat file.json | jq
Re:JMESPath – A query language for JSON by zephharben on Saturday February 17, 2018 @12:21PM (#16401618)
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).

Re:JMESPath – A query language for JSON by cryptonector on Saturday February 17, 2018 @02:59PM (#16402414)
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 by billsmithaustin on Saturday February 17, 2018 @11:27AM (#16401336)
I use jq frequently. It covers most of what I want to do.