Skip to main content

Function: tryParseJsonRecord()

tryParseJsonRecord(text: string): UnknownRecord | null

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

Attempts to parse a JSON string into a plain object record.

Parametersโ€‹

textโ€‹

string

Returnsโ€‹

UnknownRecord | null

Remarksโ€‹

This is intentionally strict: arrays are rejected.

Use this when you need best-effort extraction from third-party payloads (e.g. OAuth error bodies) without throwing.