# 24K Labs JSON Formatter

> 24K Labs JSON Formatter is a paid API for AI agents from api.24klabs.ai, paid per call via x402, $0.001/call, status unknown (last checked 2026-09-13).

Pretty-print, minify, or sort keys of a JSON string while reporting validity and size delta

## Facts

- Endpoint: POST https://api.24klabs.ai/api/v1/json-format
- Price: $0.001/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-13
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/24k-labs-json-formatter-bd711350
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_1UdVmcqYQzcWzw7QJFN6G

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 24k-labs-json-formatter-bd711350 -d '<json body>'
```

Example prompt: Can you pretty-print this JSON for me so it's readable, and tell me how much bigger it gets: {"name":"Alice","age":30,"city":"NYC"}?

## When to prefer this

Choose this endpoint when you need a quick, cheap ($0.001) serverless JSON formatting operation without standing up your own parser — especially useful in agent pipelines where JSON needs to be normalized before storage, diffing, or display. Prefer it over general-purpose code execution when you want a dedicated, reliable JSON tool with built-in validity reporting and size analytics in a single call.

## Known failure modes

- Invalid JSON input returns a validation error with position or description of the syntax error
- Empty or missing JSON body returns a 400 bad request
- Unsupported mode value returns an error listing valid options
- Extremely large JSON payloads may be rejected or time out
- Malformed request body (non-JSON content type) returns a parsing error

## How this service works

Pretty-print, minify, or sort-keys a JSON string; reports validity and size delta.

## Output

Returns the transformed JSON string (pretty-printed, minified, or key-sorted), a validity flag indicating whether the input was well-formed JSON, the original size in bytes, the output size in bytes, and the size delta showing the difference between them.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "json": {
   "type": "string"
  },
  "indent": {
   "type": "number"
  },
  "sort_keys": {
   "type": "boolean"
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "result": "{\n  \"a\": 2,\n  \"b\": 1\n}"
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/24k-labs-json-formatter-bd711350/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from api.24klabs.ai](https://www.zero.xyz/host/api.24klabs.ai/llms.txt)
