MCPcopy Create free account
hub / github.com/arctic-cli/interface / parseJson

Function parseJson

packages/arctic/src/cli/claude-import.ts:630–643  ·  view source on GitHub ↗
(text: string, filepath: string)

Source from the content-addressed store, hash-verified

628}
629
630function parseJson(text: string, filepath: string): any | undefined {
631 try {
632 return JSON.parse(text)
633 } catch {
634 const errors: JsoncParseError[] = []
635 const data = parseJsonc(text, errors, { allowTrailingComma: true })
636 if (errors.length > 0) {
637 const msg = errors.map((err) => printParseErrorCode(err.error)).join(", ")
638 log.warn("failed to parse jsonc", { path: filepath, errors: msg })
639 return undefined
640 }
641 return data
642 }
643}
644
645async function importClaudeMcpServers(servers: Record<string, any>, targetConfigPath: string) {
646 const targetDir = path.dirname(targetConfigPath)

Callers 3

readClaudeMcpServersFunction · 0.85
importClaudeMcpServersFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected