# Swift Bot Labs Toolbox – JSON Format

> Swift Bot Labs Toolbox – JSON Format is a paid API for AI agents from x402-toolbox.swiftbotlab.workers.dev, paid per call via x402, $0.003/call, status unknown (last checked 2026-10-31).

Formats, minifies, or canonicalizes a JSON string and returns structural metadata (byte size, depth, node count, validity).

## Facts

- Endpoint: POST https://x402-toolbox.swiftbotlab.workers.dev/v1/json/format?utm_source=zero.xyz
- Price: $0.003/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-31
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/swift-bot-labs-toolbox-json-format-e488b91c
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_6WTzqb28srXuv4xINt0fX

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 swift-bot-labs-toolbox-json-format-e488b91c -d '<json body>'
```

Example prompt: Can you pretty-print this JSON with 4-space indentation and sort the keys alphabetically: '{"z":1,"a":[1,2,{"c":null}],"b":true}'?

## When to prefer this

Choose this endpoint when you need a quick, stateless, pay-per-call JSON formatter with no account setup — especially when you also want structural metadata (depth, node count, byte size) alongside formatting. Ideal for agents that process JSON on-the-fly without a bundled utility library.

## Known failure modes

- Invalid JSON input returns ok=false or an error message
- JSON text exceeding 524288 bytes is rejected
- Unsupported mode or indent value causes a validation error
- Payment failure via x402 blocks the request before processing

## How this service works

62 small, deterministic utility APIs (DNS and e-mail checks, web extraction, EVM decoding, x402 checks, IP math, JSON/CSV, hashing, conversions). No account or API key: pay per call in USDC with x402.

## Output

Returns a JSON object with ok=true, the tool name, and a result containing: the reformatted JSON string, its byte size, maximum nesting depth, total node count, and a boolean indicating whether the input was valid JSON.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "json": {
   "type": "string",
   "maxLength": 524288,
   "description": "JSON text"
  },
  "mode": {
   "enum": [
    "pretty",
    "minify",
    "canonical"
   ],
   "type": "string",
   "default": "pretty"
  },
  "indent": {
   "enum": [
    0,
    2,
    4,
    8
   ],
   "type": "integer",
   "default": 2
  },
  "sortKeys": {
   "type": "boolean",
   "default": false
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "ok": true,
  "tool": "json-format",
  "result": {
   "bytes": 27,
   "depth": 3,
   "nodes": 6,
   "valid": true,
   "result": "{\"a\":[1,2,{\"c\":null}],\"b\":1}"
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/swift-bot-labs-toolbox-json-format-e488b91c/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from x402-toolbox.swiftbotlab.workers.dev](https://www.zero.xyz/host/x402-toolbox.swiftbotlab.workers.dev/llms.txt)
