Home > @rushstack/node-core-library > JsonFile
JsonFile class
Utilities for reading/writing JSON files.
Signature:
export declare class JsonFile
Methods
Method | Modifiers | Description |
---|---|---|
load(jsonFilename, options) | static | Loads a JSON file. |
loadAndValidate(jsonFilename, jsonSchema, options) | static | Loads a JSON file and validate its schema. |
loadAndValidateAsync(jsonFilename, jsonSchema, options) | static | An async version of JsonFile.loadAndValidate(). |
loadAndValidateWithCallback(jsonFilename, jsonSchema, errorCallback, options) | static | Loads a JSON file and validate its schema, reporting errors using a callback |
loadAndValidateWithCallbackAsync(jsonFilename, jsonSchema, errorCallback, options) | static | An async version of JsonFile.loadAndValidateWithCallback(). |
loadAsync(jsonFilename, options) | static | An async version of JsonFile.load(). |
parseString(jsonContents, options) | static | Parses a JSON file's contents. |
save(jsonObject, jsonFilename, options) | static | Saves the file to disk. Returns false if nothing was written due to options.onlyIfChanged. |
saveAsync(jsonObject, jsonFilename, options) | static | An async version of JsonFile.save(). |
stringify(jsonObject, options) | static | Serializes the specified JSON object to a string buffer. |
updateString(previousJson, newJsonObject, options) | static | Serializes the specified JSON object to a string buffer. |
validateNoUndefinedMembers(jsonObject) | static | Used to validate a data structure before writing. Reports an error if there are any undefined members. |