# JSON Canonicalize

> JSON Canonicalize is a paid API for AI agents from x402-gateway-production-1f21.up.railway.app, paid per call via x402, $0.001/call, status unknown (last checked 2026-10-12).

Canonicalizes a JSON object into a deterministic, normalized form for consistent checksums and encoding.

## Facts

- Endpoint: POST https://x402-gateway-production-1f21.up.railway.app/json/canonicalize?utm_source=zero.xyz
- Price: $0.001/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-12
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/json-canonicalize-f8fa4da6
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_LFpyGPIYRS_hzeW9C9sve

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-f8fa4da6 -d '<json body>'
```

Example prompt: Take this JSON object and canonicalize it into a deterministic form so I can reliably hash or sign it: {"z":1,"a":2,"m":{"b":3,"a":1}}.

## When to prefer this

Use this endpoint when you need a deterministic, canonical representation of a JSON object for purposes such as content-addressable hashing, digital signatures, deduplication, or reproducible storage. Prefer this over ad-hoc serialization when key ordering consistency across different systems or libraries is critical.

## Known failure modes

- Missing required 'input' field returns validation error
- Invalid body structure or missing 'value' field causes schema rejection
- Malformed JSON in body causes parse error
- Payment not included or insufficient USDC causes 402 response

## How this service works

Machine-payable x402 utilities for hashing, Base64, UUID generation, unit and timezone conversion, realtime crypto market data, webpage/document extraction, URL-to-Markdown, metadata, RAG ingestion and deterministic website change detection.

## Output

A deterministically serialized canonical JSON string where keys are sorted and formatting is normalized, suitable for hashing, signing, or comparison.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "required": [
  "input"
 ],
 "properties": {
  "input": {
   "type": "object",
   "required": [
    "type",
    "method",
    "bodyType",
    "body"
   ],
   "properties": {
    "body": {
     "type": "object",
     "required": [
      "value"
     ],
     "properties": {
      "value": {}
     },
     "additionalProperties": false
    },
    "type": {
     "type": "string",
     "const": "http"
    },
    "method": {
     "enum": [
      "POST"
     ],
     "type": "string"
    },
    "bodyType": {
     "enum": [
      "json",
      "form-data",
      "text"
     ],
     "type": "string"
    }
   },
   "additionalProperties": false
  },
  "output": {
   "type": "object",
   "required": [
    "type"
   ],
   "properties": {
    "type": {
     "type": "string"
    },
    "example": {
     "type": "object"
    }
   }
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "status": "ready"
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/json-canonicalize-f8fa4da6/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from x402-gateway-production-1f21.up.railway.app](https://www.zero.xyz/host/x402-gateway-production-1f21.up.railway.app/llms.txt)
