@sqlrooms/utils / safeJsonParse
Function: safeJsonParse()
safeJsonParse<
T
>(json
):null
|T
Parse a JSON string and return the parsed object. If the string is not valid JSON, return null.
Type Parameters
Type Parameter |
---|
T |
Parameters
Parameter | Type | Description |
---|---|---|
json | undefined | null | string | The JSON string to parse. |
Returns
null
| T
The parsed object or null if the string is not valid JSON.