Python (Scripting) - Parse JSON using json.tool
by
Jeremy Canfield |
Updated: October 28 2023
| Python (Scripting) articles
There are a number of different ways to parse JSON.
- json.load - parse a JSON file
- json.loads - parse JSON (key:value pairs)
- json.dumps - get the json output of a dictionary
- json.tool - parse JSON on the command line (this article)
- .json() filter - parse JSON results
The python -m json.tool command can be used to produce human friendly JSON output on the command line.
~]$ echo '{ "foo": "Hello", "bar": "World" }' | python -m json.tool
{
"bar": "World",
"foo": "Hello"
}
Did you find this article helpful?
If so, consider buying me a coffee over at