FracturedJson, in your browser
A Prettier / oxfmt-style --check + --write CLI for JSON. Ships prebuilt WASM — no Rust toolchain needed.
npm i -D fjson-fmt
# format in place (default)
fjson-fmt "**/*.json"
# verify in CI — exits 1 if anything would change
fjson-fmt --check "**/*.json"
# stdin → stdout
cat data.json | fjson-fmt --stdin
Run alongside oxfmt (which owns JS/TS/CSS):
{
"scripts": {
"fmt": "oxfmt && fjson-fmt \"**/*.json\"",
"fmt:check": "oxfmt --check && fjson-fmt --check \"**/*.json\""
}
}
The same import works in Node and the browser (isomorphic). format() is async and initializes the engine on first use.
import { format } from "fjson-fmt";
const pretty = await format(json, {
max_total_line_length: 120,
indent_spaces: 2,
});
In Node a synchronous path is available immediately:
import { formatSync } from "fjson-fmt";
const out = formatSync(json, { number_list_alignment: "right" });