JSON5 Viewer

Paste JSON5 — the relaxed JSON dialect used by config files — and read it as a collapsible tree, then copy out strict, standard JSON. The parser accepts everything JSON5 adds: // and /* */ comments, trailing commas, unquoted and single-quoted keys, single-quoted strings, hexadecimal numbers, and leading-+ or leading-dot numbers. It tokenizes properly, so text that looks like a comment inside a string is preserved rather than stripped. Everything runs in your browser, so config files and their values are never uploaded.

How to use the JSON5 Viewer

Paste JSON5 into the box, or load a .json5 / .json / .jsonc file. The viewer parses it and shows a collapsible tree: objects and arrays fold and unfold, keys are highlighted, and strings, numbers, booleans, and null are color-coded by type. Use Expand all and Collapse all to open or close the whole document. If the input has a syntax error, the message line tells you what went wrong and roughly where, which is faster than guessing at a stray comma.

Tick Show strict JSON output to replace the tree with a formatted, fully standards-compliant JSON document. Comments are dropped, trailing commas removed, all keys and strings double-quoted, and hex or +-prefixed numbers normalized to plain decimal — the result will parse with any JSON.parse or strict validator. This is the view to copy when a tool downstream rejects JSON5 and demands canonical JSON. Because parsing happens entirely in your browser, you can clean up a private config file without sending it anywhere.

What is JSON5, and how does it differ from JSON and JSONC?

JSON5 is a superset of JSON designed to be easier for humans to write and maintain, particularly in configuration files. Standard JSON is a strict data-interchange format: it forbids comments, requires double quotes around every key and string, disallows trailing commas, and accepts only a narrow numeric syntax. Those rules are excellent for machine-to-machine transfer but painful when a person is hand-editing a settings file and wants to leave a note, line up a list, or paste in a hex color. JSON5 relaxes the grammar to remove that friction while keeping the data model identical to JSON.

The additions JSON5 brings over JSON are: single-line // and block /* */ comments; trailing commas in objects and arrays; unquoted object keys that are valid identifiers, and single-quoted strings and keys; multi-line strings via a line-continuation backslash; and an expanded number syntax that allows leading +, a leading or trailing decimal point (.5, 5.), hexadecimal literals (0xFF), and the IEEE values Infinity, -Infinity, and NaN. Despite all this, a JSON5 document still decodes to the same objects, arrays, strings, numbers, booleans, and null that JSON produces, which is why it is straightforward to convert JSON5 back to strict JSON for any consumer that needs it.

JSON5 is not the only relaxed dialect, and the distinction matters. JSONC ("JSON with Comments"), popularized by Visual Studio Code for files like tsconfig.json and settings.json, adds only comments and trailing commas — it still requires double-quoted keys and standard JSON numbers. JSON5 goes further with unquoted keys, single quotes, and the extended number forms. Many tools that advertise JSON5 support actually accept the JSONC subset, so it pays to know which features a given parser truly handles. Because the two share comments and trailing commas, most JSONC files are valid JSON5, but the reverse is not guaranteed. This viewer parses the full JSON5 grammar and emits canonical JSON, giving you a clean bridge between the relaxed editing format and the strict interchange format.

Common use cases

  • Reading config files. Explore a commented JSON5 settings file as a tree to understand its structure quickly.
  • Stripping to strict JSON. Convert a JSON5 or JSONC file into canonical JSON for a parser or API that rejects comments and trailing commas.
  • Debugging syntax errors. Find the unbalanced bracket, missing comma, or stray quote that a strict validator only reports vaguely.
  • Sharing clean data. Take a hand-edited JSON5 document and produce normalized JSON to commit or send onward.

Frequently asked questions

Which JSON5 features are supported?

All of the core ones: // and /* */ comments, trailing commas, unquoted identifier keys, single-quoted strings and keys, hexadecimal numbers, leading + and leading-or-trailing decimal points, and Infinity/-Infinity/NaN.

Will comment-like text inside a string be removed?

No. The parser tokenizes strings before it ever looks for comments, so a value such as "https://example.com" or "use // carefully" is preserved exactly. Naive find-and-replace approaches break on this; this one does not.

What is the difference between the tree and strict JSON views?

The tree is an interactive, collapsible representation for reading and navigating. The strict JSON output is a formatted document with comments removed, all keys and strings double-quoted, and numbers normalized, so it parses with any standard JSON parser.

How is JSON5 different from JSONC?

JSONC adds only comments and trailing commas to JSON and still requires double quotes and standard numbers. JSON5 also allows unquoted keys, single quotes, hex numbers, and more. Most JSONC files are valid JSON5, but not the reverse.

Is my input uploaded?

No. JSON5 is parsed and converted entirely in your browser with client-side JavaScript. Nothing is transmitted to any server, so private configuration files and their values stay on your device.