UNPKG

@assistant-ui/react

Version:

React components for AI chat.

15 lines (13 loc) 282 B
import sjson from "secure-json-parse"; import { fixJson } from "./fix-json"; export const parsePartialJson = (json: string) => { try { return sjson.parse(json); } catch { try { return sjson.parse(fixJson(json)); } catch { return undefined; } } };