Edit and convert JSON

Font size

JSON input

JSON Parsing Error

Code snippet


										

Full error message

Waiting for JSON
1:1

Output

0 B

JSON Formatter – Format, Validate & Convert JSON to XML/YAML

A free online tool to validate and format JSON, view it as a tree, and convert it to XML or YAML.

Automate link and QR code creation with the API

JSON Formatter indenting unformatted JSON

Real-time validation and scroll sync

A JSON formatter (or JSON beautifier) adds line breaks and indentation (2, 3 or 4 spaces) to minified or messy JSON so it is easy to read. It changes only the layout: keys, values, number formats and key order stay the same. To sort keys by name, use Sort Keys. In JSON output mode, use Minify to copy JSON with formatting whitespace removed and spaces inside strings preserved.

Real-time validation runs as you type. When there is an error, it shows the line, column, and surrounding code, so you can quickly spot trailing commas, single quotes, and unmatched brackets.

Turn on Scroll Sync to move the input on the left and the result on the right together. Even with hundreds of lines, you can compare the source and the result at the same position.

JSON statistics, bookmarks and auto-saved settings

JSON Statistics show the size, key count, nesting depth, number of arrays and objects, and root type. This helps you understand the structure of an API response.

Save up to 10 frequently used JSON snippets with a title in Bookmarks. Saved data stays in this browser and is never sent to a server.

Editor settings are saved automatically, including font size, indentation, and theme, and remain in place when you reopen the page.

JSON pretty print code by language

Here is how to output indented JSON (pretty print) in code. Use it for logging or debugging API responses.

Language Code Indentation
JavaScript / Node.js JSON.stringify(obj, null, 2) 2 spaces (set any number)
Python json.dumps(data, indent=4, ensure_ascii=False) 4 spaces (keeps non-ASCII characters)
Java (Jackson) mapper.writerWithDefaultPrettyPrinter().writeValueAsString(obj) Jackson default
PHP json_encode($data, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE) 4 spaces (keeps non-ASCII characters)
Go json.MarshalIndent(data, "", " ") 2 spaces
C# JsonSerializer.Serialize(obj, new JsonSerializerOptions { WriteIndented = true }) 2 spaces
Ruby JSON.pretty_generate(data) 2 spaces

Paste JSON output from your code to inspect its structure, or copy the formatted JSON here into your code.

JSON vs. XML vs. YAML: how to choose

All three formats structure data, but each serves a different purpose.

Criteria JSON XML YAML
Main use REST APIs, web app data exchange Legacy system integration, complex documents CI/CD configs, Docker, Kubernetes
File size Lightweight Heavier due to repeated tags Lightweight
Readability High (key-value structure) Moderate (nested tags) Very high (indentation-based)
Comments Not in the standard Supported Supported (#)
Parsing speed Fast Relatively slow Moderate
Browser support Built in Requires a parser Requires a parser
Data types Numbers, booleans, and null All strings Numbers, booleans, and null

JSON is the standard for REST APIs and web application data. YAML suits configuration files edited by hand, while XML fits integration with existing enterprise systems. Switch the output format to compare the same data instantly.

Tree view and XML/YAML conversion

Switch deeply nested JSON to Tree view to see its hierarchy at a glance. Expand or collapse nodes to focus on what you need.

Select XML or YAML as the output format to see the converted result on the right. You can copy it or save it as a file.

Open files, load from URL and full screen

Open a UTF-8 .json file or load JSON from a URL that allows browser requests. Inputs up to 10 MiB are supported. For more room to edit, select the full screen button in the toolbar.

Common JSON syntax errors

JSON has strict syntax, so even small mistakes cause parsing to fail. If you see an error, check these first.

  • Trailing commas: A comma cannot follow the last item in an array or object. This often happens when copying JavaScript objects.
  • Quotes: Keys and strings must use double quotes ("). Single quotes (') are not allowed.
  • Bracket pairs: Every array [ ] and object { } must open and close in pairs. In deeply nested data, check the line and column in the error message.

Frequently Asked Questions

In addition to formatting and validation, it offers:

  • Copy minified or escaped output
  • Real-time validation with error line and column
  • Scroll sync between input and result
  • Tree view and XML/YAML conversion
  • Key sorting (ascending or descending, with object selection)
  • Bookmarks (up to 10) and JSON statistics
  • Auto-saved editor settings

No. JSON you paste or open is processed in your browser and is never sent to Vivoldi servers. Your input is temporarily saved in this browser and restored when you return. Selecting Clear input also deletes the saved draft. Delete bookmarks separately from the list. Loading from a URL sends the request directly from your browser to that address.

Check the line and column shown in the error message. Select the message to jump to that line. Look for commas after the last item, double quotes around keys and strings, and matching square and curly brackets. The validation result updates as soon as you fix the issue.

You can open .json files saved in UTF-8. Pasting, opening a file, and loading from a URL each support up to 10 MiB. If the data has too many values or deep nesting, split it into smaller parts. For documents over about 1 million characters, automatic validation is replaced by the Format JSON button (Ctrl/Cmd+Enter), which updates the result.

Select XML or YAML as the output format, then copy the result or save it as a file. XML output is wrapped in a single root element. YAML does not allow duplicate keys, so resolve any duplicates in the input first. Copying or downloading from tree view provides the full JSON.

You can save up to 10 bookmarks with a title. Once you exceed 10, the oldest one is deleted. Bookmarks are kept only in this browser’s local storage and are not shared with other devices or browsers. Delete individual items from the bookmarks list.

Yes. In Sort Keys, choose whether to sort all objects or a specific object. Both ascending and descending order are supported, and the order of array items and the source on the left stay unchanged.

Guides for this tool