README.md 931 Bytes
Newer Older
Bob Williams's avatar
Bob Williams committed
1
2
# jsontools

3
4
5
6
7
Handy command line tools for dealing with json data.

## Tools

- **pp_json** - pretty prints json
8
- **is_json** - returns true if valid json; false otherwise
9
- **urlencode_json** - returns a url encoded string for the given json 
10
- **urldecode_json** - returns decoded json for the given url encoded string
Bob Williams's avatar
Bob Williams committed
11

12
13
14
15
16
## Usage
Usage is simple...just take your json data and pipe it into the appropriate jsontool.
```sh
<json data> | <jsontools tool>
```
17
## Examples
Bob Williams's avatar
Bob Williams committed
18

19
##### pp_json
20

Bob Williams's avatar
Bob Williams committed
21
22
23
```sh
# curl json data and pretty print the results
curl https://coderwall.com/bobwilliams.json | pp_json
24
25
26
27
28
29
```

##### is_json
```sh
# pretty print the contents of an existing json file
less data.json | is_json
30
```
31

32
33
##### urlencode_json
```sh
34
# json data directly from the command line
35
echo '{"b":2, "a":1}' | urlencode_json
36
37
38
39
40
41
```

##### urldecode_json
```sh
# url encoded string to decode
echo '%7B%22b%22:2,%20%22a%22:1%7D%0A' | urldecode_json
42
```