3 Handy command line tools for dealing with json data.
5 To use it, add `jsontools` to the plugins array in your zshrc file:
8 plugins=(... jsontools)
13 Usage is simple... just take your json data and pipe it into the appropriate jsontool:
15 - `pp_json`: pretty prints json.
16 - `is_json`: returns true if valid json; false otherwise.
17 - `urlencode_json`: returns a url encoded string for the given json.
18 - `urldecode_json`: returns decoded json for the given url encoded string.
20 ### Supports NDJSON (Newline Delimited JSON)
22 The plugin also supports [NDJSON](http://ndjson.org/) input, which means all functions
23 have an alternative function that reads and processes the input line by line. These
24 functions have the same name except using `ndjson` instead of `json`:
26 > `pp_ndjson`, `is_ndjson`, `urlencode_ndjson`, `urldecode_ndjson`.
33 # curl json data and pretty print the results
34 curl https://coderwall.com/bobwilliams.json | pp_json
40 # validate if file's content conforms to a valid JSON schema
43 # shows true / false and returns the proper exit code
51 # json data directly from the command line
52 $ echo '{"b":2, "a":1}' | urlencode_json
53 %7B%22b%22:2,%20%22a%22:1%7D
59 # url encoded string to decode
60 $ echo '%7B%22b%22:2,%20%22a%22:1%7D' | urldecode_json
67 # echo two separate json objects and pretty print both
68 $ echo '{"a": "b"}\n{"c": [1,2,3]}' | pp_ndjson