(inputStr: string)
| 7 | } |
| 8 | |
| 9 | export 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 | } |
no test coverage detected