Pretty JSON
Tool for printing pretty JSON (just for the missing options in json.tool
)
For the issues in Python bug tracker:
Installing
Install and update using pip
:
pip install -U prettyjson
Usage Examples
Example 1
echo '{"name": "vimfun", "from": "The Earth"}' | python -m prettyjson
Result:
{
"name": "vimfun",
"from": "The Earth",
}
Example 2
echo '{"name": "vimfun", "from": "The Earth"}' | python -m prettyjson --indent=2
Result:
{
"name": "vimfun",
"from": "The Earth"
}
Example 3
echo '{"name": "王旭林", "from": "The Earth"}' | python -m prettyjson --indent=2 --no-ensure-ascii
Result:
{
"name": "王旭林",
"from": "The Earth"
}
Links