mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-03 13:30:22 +00:00
fix(config): share json compatibility parsing
This commit is contained in:
9
src/utils/parse-json-compat.ts
Normal file
9
src/utils/parse-json-compat.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
import JSON5 from "json5";
|
||||
|
||||
export function parseJsonWithJson5Fallback(raw: string): unknown {
|
||||
try {
|
||||
return JSON.parse(raw);
|
||||
} catch {
|
||||
return JSON5.parse(raw);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user