# JSON Pretty Printer API

> JSON Pretty Printer API is a paid API for AI agents from api.bakhour.ca, paid per call via x402, $0.002/call, status unknown (last checked 2026-09-15).

Formats and pretty-prints raw JSON text into human-readable indented output

## Facts

- Endpoint: POST https://api.bakhour.ca/json/pretty
- Price: $0.002/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-15
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/json-pretty-printer-api-07679e3d
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_p_dQSkBRLKr1G05o1kW1I

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 json-pretty-printer-api-07679e3d -d '<json body>'
```

Example prompt: Can you pretty-print this JSON for me: {"a":1,"b":{"c":2,"d":[1,2,3]}}? I want it nicely indented so it's easy to read.

## When to prefer this

Choose this endpoint when you need a simple, deterministic, pay-per-use JSON pretty-printer callable by an AI agent or automated workflow without managing your own formatting library. It is ideal for lightweight pipelines where spinning up a local JSON formatter is impractical, or when operating in a sandboxed environment that benefits from an external utility API. The x402 micropayment model means no subscription or API key management — just pay per call.

## Known failure modes

- Invalid or malformed JSON input — the API may return an error or unpredictable output if the text field is not valid JSON
- Empty text field — may return an empty or error response
- Non-JSON text submitted — the endpoint is designed for JSON strings so arbitrary text may not be formatted meaningfully
- Payment failure — if the x402 micropayment of $0.002 USDC is not completed, the request will be rejected with a 402 status

## How this service works

Decision-grade security/due-diligence outcome reports ($20-$100) plus deterministic paid utilities ($0.001+) for software agents and automated workflows.

## Output

Returns a JSON object with a 'formatted' field containing the input JSON text pretty-printed with standard 2-space indentation and newlines, making it human-readable.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "text": {
   "type": "string"
  }
 }
}
```

## Response schema (JSON Schema)

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

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/json-pretty-printer-api-07679e3d/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from api.bakhour.ca](https://www.zero.xyz/host/api.bakhour.ca/llms.txt)
