showcase

One tree, every notation

Everything below is this library compiled to JavaScript — the same code the tests run, in the browser. The document is read as the dialect you pick, so a trailing comma and a // comment are refused by JSON with the line and the column, and accepted by JSON5 — and the sentence you see is Refused::message, printed by the library, not written by this page.

read as strict RFC 8259: no comments, no trailing comma
notations

Written every way

Pick a notation to see the document that way. The text is the core writer; the hex is the format's encoder, byte for byte.

JSON

      
formatter

Lay it out your way

The formatter takes an indent in spaces, or one tab a level, sorts the names, and escapes everything above U+007E as ASCII. It is the library's formatter, not a copy of it.

indent
output