Skip to content

PluginSettingsComponentBase.importFromJson method

PluginSettingsComponentBase › importFromJson

Replaces every setting with the ones in a JSON record, such as one exportToJson produced, and saves them.

The record is read the way data.json is: legacy converters and the transformer run, a setting it lacks takes its default, and an unknown key is ignored. The settings in use are kept as a recovery copy first, when the data handler keeps them.

Signature:

importFromJson(json: string, context?: unknown): Promise<PluginSettingsImportResult>

Parameters:

ParameterTypeDescription
jsonstringThe JSON text.
context?unknownThe save context passed to the saveSettings event.

Returns: Promise<PluginSettingsImportResult> — The unknown keys and the settings whose imported value fails validation.