pub const Options = struct whitespace: enum { minified, indent_1, indent_2, indent_3, indent_4, indent_8, indent_tab, } = .minifiedControls the whitespace emitted. The default .minified is a compact encoding with no whitespace between tokens. Any setting other than .minified will use newlines, indentation, and a space after each ':'. .indent_1 means 1 space for each indentation level, .indent_2 means 2 spaces, etc. .indent_tab uses a tab for each indentation level.
emit_null_optional_fields: bool = trueShould optional fields with null value be written?
emit_strings_as_arrays: bool = falseArrays/slices of u8 are typically encoded as JSON strings. This option emits them as arrays of numbers instead. Does not affect calls to objectField*().
escape_unicode: bool = falseShould unicode characters be escaped in strings?
emit_nonportable_numbers_as_strings: bool = falseWhen true, renders numbers outside the range +-1<<53 (the precise integer range of f64) as JSON strings in base 10.
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568pub const Options = struct {
/// Controls the whitespace emitted.
/// The default `.minified` is a compact encoding with no whitespace between tokens.
/// Any setting other than `.minified` will use newlines, indentation, and a space after each ':'.
/// `.indent_1` means 1 space for each indentation level, `.indent_2` means 2 spaces, etc.
/// `.indent_tab` uses a tab for each indentation level.
whitespace: enum {
minified,
indent_1,
indent_2,
indent_3,
indent_4,
indent_8,
indent_tab,
} = .minified,
/// Should optional fields with null value be written?
emit_null_optional_fields: bool = true,
/// Arrays/slices of u8 are typically encoded as JSON strings.
/// This option emits them as arrays of numbers instead.
/// Does not affect calls to `objectField*()`.
emit_strings_as_arrays: bool = false,
/// Should unicode characters be escaped in strings?
escape_unicode: bool = false,
/// When true, renders numbers outside the range `+-1<<53` (the precise integer range of f64) as JSON strings in base 10.
emit_nonportable_numbers_as_strings: bool = false,
}