HJSON Formatter & Validator

ДанныеРазработчик
Реклама · УДАЛИТЬ?

Или

Параметры

Validation results will appear here.
Реклама · УДАЛИТЬ?

Гид

HJSON Formatter & Validator

HJSON Formatter & Validator

Paste HJSON — the human-friendly variant of JSON that allows comments, unquoted keys and strings, multiline values, and trailing commas — and convert it to strict JSON instantly. The tool also runs the conversion in reverse: drop in strict JSON and get a cleaner HJSON version with unquoted keys for easier reading and editing.

Validation runs line-by-line as you type, so syntax errors surface immediately with line and column hints. Everything runs locally in your browser — no file upload, no server round-trip, no data leaving the page.

Как использовать

  1. Paste HJSON or strict JSON into the input box, or upload a file.
  2. Pick a direction — HJSON → JSON to clean up a human-edited config, or JSON → HJSON to make a machine-generated JSON file friendlier to maintain.
  3. Choose your indent (2 spaces, 4 spaces, tab, or minified for JSON output).
  4. Optionally sort object keys alphabetically for stable diffs.
  5. файл. Панель проверки выделяет дублирующиеся ключи и некорректные .json или .hjson файл.

Возможности

  • Two-way conversion – HJSON to strict JSON and back, with error messages pinpointing the offending line.
  • Full HJSON syntax#, //и /* */ comments; unquoted keys; quoteless single-line strings; triple-quoted multiline strings with smart dedent; trailing and optional commas.
  • Braceless root objects – top-level key: value pairs without an outer { } are recognized as a root object.
  • Clean output – choose 2-space, 4-space, tab, or minified indentation; HJSON output unquotes identifier keys for cleaner diffs.
  • Stable ordering – optional alphabetical key sorting on nested objects so your formatted output diffs cleanly across runs.
  • Local & private – parsing and formatting happen entirely in your browser; nothing is uploaded.

When to Use HJSON Instead of JSON

HJSON shines for config files that humans edit by hand: build pipelines, deployment manifests, CLI tool settings, game configs, and anywhere you want the readability of YAML without YAML’s indentation gotchas. HJSON is a strict superset of JSON, so any valid JSON is already valid HJSON — you can adopt it gradually, file by file.

Реклама · УДАЛИТЬ?

For machine-to-machine data exchange (APIs, storage, network protocols), keep strict JSON: it has universal parser support and a smaller, less ambiguous grammar. Convert HJSON to JSON at build time or load time, and let humans keep editing the friendlier source.

Часто задаваемые вопросы

  1. What is HJSON and how does it differ from JSON?

    HJSON, short for Human JSON, is a relaxed variant of JSON designed for hand-edited configuration. It adds comments (#, //, /* */), allows quoteless keys, quoteless single-line strings, multiline strings with triple quotes, and trailing or optional commas. Strict JSON disallows all of those for the sake of unambiguous machine parsing. Because every valid JSON document is also a valid HJSON document, HJSON is a strict superset — you can adopt it incrementally.

  2. How does HJSON compare to JSON5, JSONC, and YAML?

    JSON5 also adds comments and trailing commas but keeps strings quoted and requires JavaScript-style identifier keys. JSONC (JSON with Comments) only adds // and /* */ comments. YAML is far more permissive but relies on significant whitespace, which is error-prone for deeply nested structures. HJSON sits between JSON5 and YAML: most of YAML's readability with brace-delimited structure, so a misplaced indent doesn't change semantics.

  3. Are HJSON multiline strings and YAML block scalars equivalent?

    They serve the same purpose but differ in mechanics. HJSON multiline strings are delimited by triple single quotes ('''), and the indentation of the closing ''' determines how all interior lines are dedented — making the block portable across nesting levels. YAML offers literal (|) and folded (>) block scalars with separate chomping indicators (-, +) for trailing newlines. HJSON's single style is simpler at the cost of less control over trailing whitespace.

  4. Does HJSON change how numbers, booleans, and null are parsed?

    No. Numbers (including integers, decimals, and scientific notation), booleans, and null follow the same lexical rules as JSON. The disambiguation rule is straightforward: if an unquoted value parses cleanly as a JSON number, true, false, or null, it is parsed as that primitive; otherwise it becomes a quoteless string that extends to the end of the line.

  5. Can comments be preserved when converting HJSON to JSON?

    Not in the standard sense — strict JSON has no comment grammar, so a faithful conversion must drop them. Some toolchains work around this by keeping the HJSON file as the source of truth and producing JSON only as a build artifact, or by storing comments under a sibling key like _comment. If preserving comments matters, treat HJSON as your editable source and regenerate JSON on demand rather than the other way around.

Хотите убрать рекламу? Откажитесь от рекламы сегодня

Установите наши расширения

Добавьте инструменты ввода-вывода в свой любимый браузер для мгновенного доступа и более быстрого поиска

в Расширение Chrome в Расширение края в Расширение Firefox в Расширение Opera

Табло результатов прибыло!

Табло результатов — это интересный способ следить за вашими играми, все данные хранятся в вашем браузере. Скоро появятся новые функции!

Реклама · УДАЛИТЬ?
Реклама · УДАЛИТЬ?
Реклама · УДАЛИТЬ?

новости с техническими моментами

Примите участие

Помогите нам продолжать предоставлять ценные бесплатные инструменты

Купи мне кофе
Реклама · УДАЛИТЬ?