Skip to content

StringifyJsonOptions

Defined in: stringify-json.ts:2

Options for stringifyJson.

optional indent?: string | number

Defined in: stringify-json.ts:8

Indent for each level: a number of spaces (a non-negative integer) or a string of spaces and tabs (e.g. "\t"). Any length works, unlike JSON.stringify’s own ten-character cap. Default 2.


optional like?: string

Defined in: stringify-json.ts:15

The existing file’s text. Its detected indent and line endings are used instead of indent, so rewriting a file doesn’t reformat it. Falls back to indent when no indent can be detected (empty or single-line input). A file that mixes \r\n and \n keeps whichever it uses more (\n on a tie).