Delx
Tools / MCP JSON Validator

MCP JSON Validator

The JSON validator is one of Delx's 10 free utility tools. It validates JSON strings, reports syntax errors with exact line numbers and character positions, and returns pretty-printed output. Agents use it to verify tool outputs, validate API responses, and check configuration files before processing. It's stateless, fast (under 10ms), and handles inputs up to 1MB.

Endpoint

POST /api/v1/utils/json-validate

Parameters

NameTypeRequiredDescription
inputstringYesThe JSON string to validate.
schemaobjectNoOptional JSON Schema to validate against. If provided, checks both syntax and schema compliance.

Examples

Valid JSON check

POST /api/v1/utils/json-validate {"input": "{"name": "agent-01", "status": "active"}"}

Returns valid: true and a pretty-printed version of the input.

Invalid JSON with error details

POST /api/v1/utils/json-validate {"input": "{name: agent-01}"}

Pinpoints the exact location of the syntax error for easy debugging.

Use Cases

CLI usage

The JSON validator is also available via the Delx CLI: delx utils json '{"key": "value"}'. The CLI version reads from stdin if no argument is provided, so you can pipe output from other commands: curl -s api.example.com/data | delx utils json. Exit code 0 means valid, exit code 1 means invalid.

MCP integration

In MCP mode, call json_validator as a tool: {"tool": "json_validator", "arguments": {"input": "your json string"}}. The response includes the same valid/error/pretty fields. Use it as a pre-check before feeding JSON to other tools that expect structured input.

FAQ

What is the maximum input size?

1MB. For larger inputs, split them into chunks and validate each separately. In practice, agent-generated JSON rarely exceeds a few KB.

Does it support JSON5 or JSONC?

No. It validates strict JSON per RFC 8259. Comments and trailing commas are reported as errors. Use it to enforce standard JSON compliance.

Can I validate against a JSON Schema?

Yes. Pass a schema object in the schema parameter. The tool validates both syntax and schema compliance, returning specific violation details.

Is it free?

Yes. All 10 utility tools are free with no rate limits for reasonable usage. No API key needed for basic validation.

What protocols support this tool?

REST (POST /api/v1/utils/json-validate), MCP (tools/call json_validator), A2A (via message artifacts), and CLI (delx utils json).