JSON Formatter

Free online JSON Formatter.

Calculator

How to Use

  1. Paste your JSON data into the input field
  2. Select formatting options (indent size, sort keys)
  3. Click format to validate and pretty-print the JSON
  4. View the formatted output with error highlighting if invalid

Formula

JSON structure: objects {}, arrays [], key-value pairs\nValid JSON requires: double-quoted keys, trailing commas forbidden\nIndentation: 2 spaces (standard) or 4 spaces (alternative)\nMinification: remove all whitespace, shortest valid form\nParse errors: line and column number reported

Example Calculations

Format JSON

Input: {\"name\":\"John\",\"age\":30,\"city\":\"NYC\"}

Result: Pretty-printed with 2-space indentation, validated OK

Find error

Input: {'name': 'John', 'age': 30,}

Result: Error: Line 1, col 2 - use double quotes. Line 1, col 25 - trailing comma

About This Calculator

Format, validate, and minify JSON data with syntax highlighting. Free JSON formatter tool for developers working with APIs and data files.

Our json formatter is free, easy to use, and provides instant results. All calculations are performed in your browser for privacy and speed.

Related Calculators

Frequently Asked Questions

What makes JSON invalid?

Common errors: single quotes instead of double quotes, trailing commas, unquoted keys, comments (not allowed in standard JSON), and missing brackets. Use a validator to find the exact error.

How do I minify JSON?

Remove all whitespace between tokens. {\"name\":\"John\",\"age\":30} instead of formatted version. Minified JSON is smaller for network transfer but harder to read.

What is the difference between JSON and JSONB?

JSON stores data as text (parsed on read). JSONB stores data in binary format (parsed on write, faster reads). PostgreSQL uses JSONB for indexed JSON queries.

Can JSON contain functions or dates?

Standard JSON supports only: strings, numbers, booleans, null, objects, and arrays. Dates must be strings (ISO 8601 format). Functions are not supported. Use JSON.parse and JSON.stringify in JavaScript.