parseJsonConfig
parseJsonConfig<
T>(raw,schema):JsonConfigResult<T>
Defined in: packages/simply-core/src/config/loadJsonConfig.ts:47
Parse a JSON string and validate it against a schema.
Type Parameters
Section titled “Type Parameters”T
Parameters
Section titled “Parameters”string
The raw JSON text to parse.
schema
Section titled “schema”ConfigSchema<T>
The schema to validate the parsed value against.
Returns
Section titled “Returns”The validated value, or the validator’s error message.
Throws
Section titled “Throws”If raw isn’t valid JSON. Callers that want to report malformed JSON
differently from schema violations should catch this; the two failures are otherwise
indistinguishable to whoever wrote the file.