Skip to main content

Function: safeJsonParseValue()

function safeJsonParseValue(json: string): SafeJsonResult<JsonValue>;

Defined in: shared/utils/jsonSafety.ts:126

Parses a JSON string into a normalized JSON value.

Parametersโ€‹

jsonโ€‹

string

Raw JSON string to parse.

Returnsโ€‹

SafeJsonResult<JsonValue>

Structured result containing the normalized JSON value or a message.

Remarksโ€‹

Use this at trust boundaries that need the raw parsed value for downstream schema validation. Object entries are cloned into null-prototype records with data-backed own properties, matching the safer behavior of the typed parse helpers without requiring a domain-specific validator at this layer.