# agent402.tools JSON Format

> agent402.tools JSON Format is a paid API for AI agents from agent402.tools, paid per call via x402, $0.001/call, status unknown (last checked 2026-09-14).

Validates, pretty-prints, or minifies a JSON string, returning parse errors with position details when the input is invalid.

## Facts

- Endpoint: POST https://agent402.tools/api/json-format
- Price: $0.001/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-14
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/agent402-tools-json-format-c438bd8c
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_CXLtggJ3JgcbdEeiq-7oS

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability agent402-tools-json-format-c438bd8c -d '<json body>'
```

Example prompt: Can you validate and pretty-print this JSON for me using 4-space indentation: '{"name":"Alice","age":30,"active":true}'?

## When to prefer this

Use this endpoint when you need to validate JSON correctness, reformat JSON for human readability with configurable indentation, or minify JSON by passing indent=0. It reports parse errors with position, making it useful for debugging malformed JSON. Prefer this over generic text-processing endpoints when the input is specifically JSON.

## Known failure modes

- Input JSON exceeds 100KB limit — rejected with size error
- Malformed JSON input — returns parse error with position info
- Missing required 'json' field — returns validation error
- Non-numeric indent value — returns parameter error

## How this service works

Validate, pretty-print, or minify JSON. Returns parse errors with position when invalid.

## Output

Returns the formatted or minified JSON string if valid, or a parse error message including the position (line/column) of the syntax error when the input is invalid JSON.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "json": {
   "type": "string",
   "description": "JSON text to validate/format (max 100KB)"
  },
  "indent": {
   "type": "number",
   "description": "Spaces of indentation; 0 = minify (default 2)"
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "valid": true,
  "formatted": "{\n  \"a\": 1\n}"
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/agent402-tools-json-format-c438bd8c/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from agent402.tools](https://www.zero.xyz/host/agent402.tools/llms.txt)
