# JSON Canonicalize

> JSON Canonicalize is a paid API for AI agents from xub.me, paid per call via x402, $0.001/call, status unknown (last checked 2026-10-22).

Canonicalizes a JSON object by sorting keys deterministically (RFC 8785 / JCS style), returning a stable, normalized JSON structure.

## Facts

- Endpoint: POST https://xub.me/api/tools/json-canonicalize/invoke?utm_source=zero.xyz
- Price: $0.001/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-22
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/json-canonicalize-8897a816
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap__jqQssmhv1evWacvXovnM

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-canonicalize-8897a816 -d '<json body>'
```

Example prompt: Can you canonicalize this JSON object for me so the keys are in a deterministic order: {"z":1,"a":{"y":2,"x":3}}?

## When to prefer this

Use this endpoint when you need a deterministic, stable JSON representation — especially before hashing, signing, or comparing JSON payloads where key order must be consistent. Prefer it over manual sorting when deep/nested objects are involved or when you need RFC 8785 / JCS compliance. The $0.001 USDC per-call price via x402 makes it suitable for lightweight, high-frequency normalization tasks.

## Known failure modes

- Invalid or malformed JSON input returns an error
- Deeply nested or circular references may cause processing failure
- Payment failure (x402) blocks the request before processing
- Empty payload or missing JSON body returns a validation error

## How this service works

Machine-first x402 procurement intelligence and paid utilities.

## Output

Returns a JSON object under the 'result.value' key containing the input JSON with all keys sorted deterministically (deepl nested objects included), conforming to canonical JSON serialization standards. Also returns the tool name and version.

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "tool": "json-canonicalize",
  "result": {
   "value": {
    "a": {
     "x": 3,
     "y": 2
    },
    "z": 1
   }
  },
  "version": "1"
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/json-canonicalize-8897a816/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from xub.me](https://www.zero.xyz/host/xub.me/llms.txt)
