MCPcopy Index your code
hub / github.com/simstudioai/sim / validateJson

Function validateJson

apps/sim/lib/guardrails/validate_json.ts:9–19  ·  view source on GitHub ↗
(inputStr: string)

Source from the content-addressed store, hash-verified

7}
8
9export function validateJson(inputStr: string): ValidationResult {
10 try {
11 JSON.parse(inputStr)
12 return { passed: true }
13 } catch (error: any) {
14 if (error instanceof SyntaxError) {
15 return { passed: false, error: `Invalid JSON: ${error.message}` }
16 }
17 return { passed: false, error: `Validation error: ${error.message}` }
18 }
19}

Callers 1

executeValidationFunction · 0.90

Calls 1

parseMethod · 0.80

Tested by

no test coverage detected