You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gpt-pilot/src/utils/parse-json-compat.ts

10 lines
178 B
TypeScript

import JSON5 from "json5";
export function parseJsonWithJson5Fallback(raw: string): unknown {
try {
return JSON.parse(raw);
} catch {
return JSON5.parse(raw);
}
}