# JSON Format – Pretty-Print or Minify JSON

> JSON Format – Pretty-Print or Minify JSON is a paid API for AI agents from json-data-tools.x402tookit.com, paid per call via x402, $0.02/call, status unknown (last checked 2026-10-30).

Pretty-prints or minifies a JSON string with optional key sorting, returning the reformatted text plus before/after character counts.

## Facts

- Endpoint: GET https://json-data-tools.x402tookit.com/json-format?utm_source=zero.xyz
- Price: $0.02/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-30
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/json-format-pretty-print-or-minify-json-c13bb102
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_SAFg-BkYLuSxbDWFS479q

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-format-pretty-print-or-minify-json-c13bb102
```

Example prompt: Can you pretty-print this JSON for me with 4-space indentation and sort the keys alphabetically: {"z":1,"a":2,"m":{"b":3,"a":4}}? Also tell me how many characters it is before and after.

## When to prefer this

Choose this endpoint when you need to reformat, compress, or canonicalize a JSON string and also want to know the before/after size impact. It combines pretty-printing, minification, and key sorting in a single call, making it ideal for pipelines that need a consistent JSON representation or want to measure payload size reduction.

## Known failure modes

- Invalid JSON input returns an error response rather than formatted output
- Extremely large JSON strings may time out or hit size limits
- Malformed query parameters (e.g. non-integer indent) may cause a 400 error
- Network or payment (x402) failures result in no response

## How this service works

Pretty-print or minify JSON, optionally sorting keys, and report the size before and after.

## Output

Returns the reformatted JSON string (pretty-printed or minified, with keys optionally sorted), plus the character count of the input before formatting and the output after formatting, allowing you to measure compaction or expansion.

## 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"
   ],
   "properties": {
    "type": {
     "type": "string",
     "const": "http"
    },
    "method": {
     "enum": [
      "GET"
     ],
     "type": "string"
    },
    "queryParams": {
     "type": "object",
     "required": [
      "json"
     ],
     "properties": {
      "json": {
       "type": "string",
       "description": "The JSON text"
      },
      "sort": {
       "type": "string",
       "description": "true to sort keys"
      },
      "indent": {
       "type": "integer",
       "description": "Spaces 0 to 8; 0 minifies. Default 2"
      }
     }
    }
   },
   "additionalProperties": false
  },
  "output": {
   "type": "object",
   "required": [
    "type"
   ],
   "properties": {
    "type": {
     "type": "string"
    },
    "example": {
     "type": "object",
     "properties": {
      "asOf": {
       "type": [
        "null",
        "string"
       ]
      },
      "source": {
       "type": [
        "null",
        "string"
       ]
      },
      "reasons": {
       "type": [
        "array",
        "null"
       ]
      },
      "summary": {
       "type": [
        "null",
        "string"
       ]
      },
      "verdict": {
       "type": [
        "null",
        "string"
       ]
      },
      "degraded": {
       "type": [
        "boolean",
        "null"
       ]
      },
      "formatted": {
       "type": [
        "null",
        "string"
       ]
      },
      "disclaimer": {
       "type": [
        "null",
        "string"
       ]
      },
      "notChecked": {
       "type": [
        "array",
        "null"
       ],
       "items": {
        "type": "string"
       }
      },
      "charactersAfter": {
       "type": [
        "null",
        "number"
       ]
      },
      "charactersBefore": {
       "type": [
        "null",
        "number"
       ]
      }
     }
    }
   }
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/json-format-pretty-print-or-minify-json-c13bb102/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from json-data-tools.x402tookit.com](https://www.zero.xyz/host/json-data-tools.x402tookit.com/llms.txt)
