Home JSON formatter

JSON formatter

Line it up with 2 spaces, 4 spaces, or a tab, and turn keys into snake_case or camelCase.

Indent
Keys

Result

Why this exists

JSON stuck on one line is hard to read. Indentation shows which part is an array and which is an object.

A string wrapped one extra time in a log can be unescaped, peeled once, and formatted again.

  1. 01How to use it

    Paste JSON or open a file. Choose the indent and the key style.

    A trailing comma or a key without quotes is still shown as strict JSON.

  2. 02What you get

    {"a":1,"b":[2]} is split onto its own lines.

    userName becomes user_name in snake_case.

    Entered{"a":1}

    JSON { "a": 1 }
  3. 03Worth knowing

    Valid JSON keeps the original spelling of numbers and strings and only gains line breaks.

    A bad spot is reported as a line and a character.

Questions

QDoes the text leave this browser?
ANo. Formatting finishes in the browser you have open.
QCan JSON with comments be read?
AYes. Comments and a trailing comma are read, then shown as strict JSON.
QWhat about a string wrapped once more?
ATurn on unescape. One string layer is peeled off and formatted again.

How this page works it out

This page indents loose or strict JSON and can rename keys to camel case or snake case.

It also accepts unquoted keys, comments, and a trailing comma, then writes strict JSON with a two-space indent. Renaming walks into nested objects and into objects inside arrays.

A grammar error points at its place. An input that is too large asks to be split. JSON that contains a secret stays in this browser and is not sent to a server.

The copied result can be pasted into another tool. Keep the original before you rename keys.

  • # JSON
  • # format
  • # snake_case
  • # camelCase