JSON: Formatting a Json readable

Hi,

if you have a unformated json expression like

{"Metallica": "Thrash", "GraveDigger": "Power","Kataklsym":"Death"}

and want to format it readable you could use the python module json.tool

Usage is quite simple:

michael@debdev ~ # echo '{"Metallica": "Thrash", "GraveDigger": "Power","Kataklsym":"Death"}' | python -m json.tool
{
    "GraveDigger": "Power",
    "Kataklsym": "Death",
    "Metallica": "Thrash"
}

Or from a file

michael@debdev ~ # cat myFile.json | python -m json.tool
{
    "GraveDigger": "Power",
    "Kataklsym": "Death",
    "Metallica": "Thrash"
}

Michael

Advertisment to support michlstechblog.info

2 thoughts on “JSON: Formatting a Json readable”

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.