Dialect::Fson (default)
Loses no information: comments, member order, key form, -- markers and number lexemes (hex, Infinity / -Infinity / NaN included) are all written back.
Format: 2-space indent; key: value, one member / element per line; compact {} / [] for empty containers unless they carry dangling comments; disabled members adjacent as --key: value; strings escape only ", \ and control characters (raw UTF-8, including U+2028 / U+2029, passes through); file ends with a newline.
Pretty output is a fixed point: write(parse(write(x))) == write(parse(x)).
Dialect::Json — strict JSON
- comments omitted
- every key quoted (
preferBareKeyshas no effect) Number::Kind::Hexlexemes rewritten to plain decimal- writing
Infinity/NegativeInfinity/NaNthrowsstd::domain_error— strict JSON cannot represent it (fson-check --jsoncatches it → exit 2) |-block strings written as ordinary quoted strings--disabled members followDisabledMemberPolicy;ConvertToCommentbehaves likeDrophere (no comments in JSON)- containers left empty after filtering are written compact
Dialect::Json5 — JSON5-compliant
- comments kept (header / leading / trailing / dangling / footer)
- bare keys kept (same rule as
Fson;preferBareKeyssupported) - number lexemes verbatim — hex stays hex,
Infinity/-Infinity/NaNstay literal --disabled members followDisabledMemberPolicy; defaultConvertToCommentsynthesizes a// key: valuecomment- any multi-line block comment (original or synthesized) is flattened to one
//line per source line — JSON5 forbids nested block comments, the one place FSON and JSON5 diverge

