RoadmapShopEvents
Skip to main content

Home > @rushstack/node-core-library > IJsonFileSaveOptions

IJsonFileSaveOptions interface

Options for JsonFile.saveJsonFile()

Signature:

export interface IJsonFileSaveOptions extends IJsonFileStringifyOptions 

Extends: IJsonFileStringifyOptions

Properties

PropertyModifiersTypeDescription
ensureFolderExists?boolean(Optional) Creates the folder recursively using FileSystem.ensureFolder() Defaults to false.
headerComment?string

(Optional) If specified, this header will be prepended to the start of the file. The header must consist of lines prefixed by "//" characters.

(Inherited from IJsonFileStringifyOptions)

ignoreUndefinedValues?boolean

(Optional) If true, conforms to the standard behavior of JSON.stringify() when a property has the value undefined. Specifically, the key will be dropped from the emitted object.

(Inherited from IJsonFileStringifyOptions)

newlineConversion?NewlineKind

(Optional) If provided, the specified newline type will be used instead of the default \r\n.

(Inherited from IJsonFileStringifyOptions)

onlyIfChanged?boolean(Optional) If there is an existing file, and the contents have not changed, then don't write anything; this preserves the old timestamp.
prettyFormatting?boolean

(Optional) If true, then the "jju" library will be used to improve the text formatting. Note that this is slightly slower than the native JSON.stringify() implementation.

(Inherited from IJsonFileStringifyOptions)

updateExistingFile?boolean(Optional) If true, use the "jju" library to preserve the existing JSON formatting: The file will be loaded from the target filename, the new content will be merged in (preserving whitespace and comments), and then the file will be overwritten with the merged contents. If the target file does not exist, then the file is saved normally.