Guides · Using the tool

JSON formatting and minification

Pretty-print when you need to read a payload. Minify when you ship it. Both are the same document. This page covers the tradeoff and the buttons in HiJSON.

What formatting does

Formatting (pretty-print) inserts indentation and line breaks so nesting is visible. API responses often arrive as one line. That is legal JSON and miserable to read by eye.

{
  "name": "HiJSON",
  "version": "1.0",
  "features": ["format", "minify", "tree"]
}

The minified form {"name":"HiJSON","version":"1.0","features":["format","minify","tree"]} is equivalent.

What minification does

Minify strips insignificant whitespace. Use it for request bodies, logs you store at volume, or embedding JSON in a bundle. Do not minify files you expect to diff in Git unless the team agreed on that.

When to do which

SituationPrefer
Debugging an API responseFormat
Reviewing a config in a PRFormat
Production HTTP bodyMinify
Git history you want to readFormat

In HiJSON

  1. Paste JSON or drop a file on the home page.
  2. Format adds 2-space indent in the editor.
  3. Minify collapses it to one line.
  4. Parse (Ctrl+Enter) builds the tree. The detail panel can copy formatted or minified text for a node.

Syntax has to be valid first

Format will not save an illegal document. Trailing commas, single quotes, and comments are the usual failures. See syntax errors.

Try it

Format and minify in the browser. Nothing is uploaded for those actions.

Open HiJSON →