Parse JSON5 — JSON with comments, trailing commas, unquoted keys, single quotes, hex numbers, NaN / Infinity, and multi-line strings — and emit strict RFC 8259 JSON. Or pretty-print strict JSON as ergonomic JSON5. 100% client-side, no network, no eval.
// line and /* block */ comments are allowed anywhere whitespace is.foo, $bar, _baz123) skip the quotes.'hello' is equivalent to "hello"; the other quote no longer needs escaping inside.0xDEADBEEF), leading/trailing decimal points (.5, 5.), explicit + sign, and NaN / ±Infinity.
Strict JSON has no representation for NaN or ±Infinity. When converting from JSON5 to JSON, those values become null and a warning is shown — that matches what JSON.stringify does for the same JavaScript values.
{
// line comment
/* block comment */
unquotedKey: 'single quotes',
"quoted": "double quotes",
hex: 0xCAFE,
decimal: .5,
trailing: 5.,
positive: +1,
infinity: Infinity,
nan: NaN,
multiline: "first line \
continued",
trailing_comma: [1, 2, 3,],
}