Tuesday, September 17, 2013

Formatting JSON files

Oftentimes you have JSON files which need to be formatted and checked for validity. You can use the following ways of going about it.

1. Using Python
cat file.json | python -mjson.tool > newfile.json

2. Uing jsonlint
Install jsonlint using 'sudo apt-get install  python-demjson'

Then use the command 

jsonlint -fv file.json > newfile.json