HJSON Formatter & Validator
Convert between HJSON and JSON, and validate as you go. HJSON is a human-friendly superset of JSON — no required quotes on keys, // and # comments, multiline ''' strings and trailing commas are all allowed. Format HJSON into pretty or minified JSON, or the reverse, with adjustable indentation, key sorting and quote style, plus a clear error message (with line/column) on malformed input.
Input
Options
Output
Guides
What is HJSON?
HJSON is a human-friendly superset of JSON, designed for config files people actually edit by hand. Object keys don't need quotes, // and # comments are allowed, strings can go unquoted, trailing commas are fine, and long text can span multiple lines with a ''' block — all things that make hand-written config painful in strict JSON.
What does this tool do?
Paste HJSON (or plain JSON) and get back cleanly formatted, validated output — in either direction:
- HJSON → JSON — parse HJSON and pretty-print (or minify) it as standard JSON, ready for an API, a build tool or anywhere strict JSON is required.
- JSON → HJSON — turn a JSON file into a comment-friendly, quote-light HJSON config, easier for a human to read and edit later.
Every run validates the input first. Malformed input doesn't fail silently — you get the parser's exact error message, including the line and column where it broke.
Features
- Convert Direction — HJSON → JSON or JSON → HJSON.
- Indent — 2 spaces, 4 spaces, tab, or minified (no indent).
- Sort object keys alphabetically — recursively, for a canonical, diff-friendly ordering.
- Quote Style (JSON → HJSON only) — minimal quoting, quote all keys, or quote all keys and string values.
- Comments (
//,#,/* */) and multiline'''strings in the source are parsed correctly. - Copy or download the result.
How to use it
- Paste HJSON or JSON into the input box — conversion happens instantly.
- Pick a Convert Direction.
- Adjust indentation, key sorting and (for JSON → HJSON) quote style as needed.
- Copy or download the output. If the input is invalid, the status box shows exactly what's wrong and where.
Is HJSON valid JSON?
Any strict JSON document is also valid HJSON — this tool accepts either as input for both conversion directions.
Does converting to JSON keep my comments?
No. JSON has no concept of comments, so converting HJSON → JSON drops them, same as any HJSON-to-JSON conversion has to.
Privacy
Parsing and formatting run entirely in your browser. Your data never leaves your device — safe for config files and secrets you'd rather not paste into a random website's server.