Files
openclaw/packages/normalization-core/src/json-coercion.ts
2026-07-04 16:33:27 -07:00

9 lines
221 B
TypeScript

/** Parses JSON without throwing, returning undefined for invalid input. */
export function safeParseJson(value: string): unknown {
try {
return JSON.parse(value) as unknown;
} catch {
return undefined;
}
}