Free · In-browser · Type inference

Format JSON. Infer TypeScript.

Pretty-print, minify, sort keys, validate with line + column error reporting, and one-click convert any JSON shape into a TypeScript type alias.

Input JSON

197 B

Output

197 B
{
  "app": "lokal",
  "version": "1.4.0",
  "features": [
    "translate",
    "resize",
    "compress"
  ],
  "pricing": {
    "starter": 9,
    "pro": 29,
    "team": 99
  },
  "released": true
}
How it works

Four steps

  1. 1

    Paste your JSON

    Anything valid — arrays, objects, nested deep. The tool reports line/column if something is off.

  2. 2

    Pick an output mode

    Pretty (2 / 4 / tab indent), minify, or TypeScript type inference.

  3. 3

    Toggle sort keys

    Alphabetises every object deeply — useful for diffs and lockfile-style comparisons.

  4. 4

    Copy or download

    One-click copy to clipboard, or save as .json / .ts (for the TypeScript output).

Questions

Frequently asked

How does TypeScript inference handle arrays?+

If every element has the same inferred type, the array becomes T[]. If elements differ, you get a union like (A | B)[]. Empty arrays become unknown[] so you can decide what to refine them to.

Does sort keys change array order?+

No. Arrays are positional — sorting them would destroy their meaning. Only object keys are sorted, and it happens recursively through nested objects.

What's the line/column reporting?+

When JSON.parse throws, we map the reported character offset back to a line and column number so you can jump to the error in your editor. Handy for large files where you can't eyeball the problem.

Is my JSON sent anywhere?+

No. Everything happens in your browser. Paste paste paste, format, copy, done.

More free tools

Keep building

— Shipping to the App Store?

Translating screenshots into every locale is what lokal was built for. Upload once, ship to every store.

Explore lokal