0

I'm looking for tool which would allow me to parse JSON from a pipeline. Like converting it to some other common formats which are easier to parse or sort or to retrieve certain elements (like XPath).

2

2 Answers 2

1

This "json" tool I found is very flexible.

json is a fast CLI tool for working with JSON. It is a single-file node.js script with no external deps (other than node.js itself).

Example usage:

$ echo '{"foo":"bar"}' | json foo
bar

$ echo '{"fred":{"age":42}}' | json fred.age    # '.' for property access
42

$ echo '{"age":10}' | json -e 'this.age++'
{
  "age": 11
}

Docs/features at http://trentm.com/json/


A list of alternative tools is also given at the bottom which are:

1
  • Can you add some information about why this would be a good tool for the OP - especially if the conversion is possible? We like more than just link-only answers on SE sites. Thanks.
    – user416
    Feb 9, 2017 at 21:24
1

You can use pythons supplied JSON Library to parse into python objects and then output in a variety of other formats also supported either by the python library or by additional libraries. These include XML/xpath.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.