Terminal and shell

Pretty-print a JSON file

Turn a squashed, hard-to-read JSON file into neat indented lines you can actually read.

Fill these in once
  1. Show it neatly
    Terminal
    python3 -m json.tool data.json

    If it complains, the file isn't valid JSON: look near the line it mentions.

  1. Show it neatly
    Terminal · Ubuntu / Debian
    python3 -m json.tool data.json

    If it complains, the file isn't valid JSON: look near the line it mentions.

  1. Show it neatly
    PowerShell
    Get-Content data.json -Raw | ConvertFrom-Json | ConvertTo-Json -Depth 20

    If it complains, the file isn't valid JSON.

New to JSON? I explain it in plain English on Layman Terms.