It's a JSON parser for shell, namely bash, which is just an adaptation of the great dominictarr/JSON.sh project which I found through JSON itself. Dominic, Thank you!
Simply add it into your own script and pipe a JSON string to it for pretty printing or to apply a JSONpath expressions:
#!/bin/bash
. ./json_functions
response_body='{"some":"JSON"}'
echo "${response_body}" | json_parse -p
echo "${response_body}" | json_parse -e '$.results[0].id'
Support for the JsonPath dot–notation. See json-path/JsonPath
-p
Pretty print.
-e
Evaluate a JSONpath expression.
-d
Debug mode.
This software is available under the following licenses:
- MIT
- Apache 2