OptionalcallOptionalcompareCompare function used when sorting object keys. Set to null to disable sorting.
OptionalescapeWhether to escape special characters in regular expressions.
OptionalescapeWhether to escape special characters in strings.
OptionalhighlightWhether to highlight syntax using terminal colors.
OptionalindentNumber of spaces to use for each level of indentation.
OptionalmaxMaximum depth to recurse into nested values.
OptionalmaxApproximate per-depth-level budget for output length.
When the accumulated output at any single depth level exceeds this value,
further nesting is collapsed. This is a heuristic safety valve, not a hard
limit — total output can reach up to roughly maxDepth × maxOutputLength.
OptionalmaxMaximum number of items to print in arrays, sets, maps, and similar collections.
OptionalminWhether to minimize added whitespace, including indentation and line breaks.
OptionalpluginsPlugins used to serialize application-specific data types.
OptionalprintWhether to print Object / Array prefixes for plain objects and arrays.
OptionalprintWhether to include the function name when formatting functions.
OptionalprintWhether to include shadow-root contents when formatting DOM nodes.
Call
toJSONon objects before formatting them. Ignored after the formatter has already calledtoJSONonce for a value.