MCPcopy
hub / github.com/codeaashu/claude-code / unescapeJsonString

Function unescapeJsonString

src/utils/sessionStoragePortable.ts:39–46  ·  view source on GitHub ↗
(raw: string)

Source from the content-addressed store, hash-verified

37 * Only allocates a new string when escape sequences are present.
38 */
39export function unescapeJsonString(raw: string): string {
40 if (!raw.includes('\\')) return raw
41 try {
42 return JSON.parse(`"${raw}"`)
43 } catch {
44 return raw
45 }
46}
47
48/**
49 * Extracts a simple JSON string field value from raw text without full parsing.

Callers 2

extractJsonStringFieldFunction · 0.85

Calls 1

parseMethod · 0.45

Tested by

no test coverage detected