# Flatten Nested JSON to Leaf Paths

> Flatten Nested JSON to Leaf Paths is a paid API for AI agents from twin.unykorn.org, paid per call via x402, $0.002/call, status unknown (last checked 2026-10-01).

Accepts a nested JSON object and returns a flat mapping of dot-separated (or custom-separator) leaf paths to their scalar values.

## Facts

- Endpoint: POST https://twin.unykorn.org/json-flatten?utm_source=zero.xyz
- Price: $0.002/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-01
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/flatten-nested-json-to-leaf-paths-babfbff8
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_gAWg3ruGOcGtObA1Ait_t

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 flatten-nested-json-to-leaf-paths-babfbff8 -d '<json body>'
```

Example prompt: Flatten this nested JSON into dot-separated leaf paths: {"user":{"name":"Alice","address":{"city":"NYC","zip":"10001"}},"active":true} — use a dot as the separator.

## When to prefer this

Use this endpoint when you need a quick, paid, serverless transformation of arbitrarily nested JSON into a flat key-path structure without setting up local parsing libraries. It is particularly useful inside agent pipelines where you want to normalize API responses, prepare data for storage or logging, or export nested configs as environment variables, and you need a reliable hosted service with a payment receipt for audit purposes.

## Known failure modes

- Invalid or malformed JSON input returns an error response
- Non-string separator values may be rejected or ignored
- Payment failure via x402 protocol results in 402 status and no transformation
- Very large or deeply recursive JSON may time out or exceed payload limits
- Arrays within the JSON may be indexed or omitted depending on implementation

## How this service works

Flatten nested JSON to leaf paths — Genesis402 / UnyKorn Operator Network

## Output

Returns a JSON object with ok: true, a flat mapping of all leaf paths (joined by the specified separator) to their scalar values, the transformation type label, and a payment receipt containing the transaction hash, USD amount charged, and a unique receipt ID.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "params": {
   "type": "object",
   "properties": {
    "json": {},
    "separator": {
     "type": "string"
    }
   }
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "ok": true,
  "type": "json-flatten",
  "receipt": {
   "tx_hash": "0x<64hex>",
   "amount_usd": 0.002,
   "receipt_id": "g402-<16hex>"
  },
  "generated_at": "<iso8601>"
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/flatten-nested-json-to-leaf-paths-babfbff8/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from twin.unykorn.org](https://www.zero.xyz/host/twin.unykorn.org/llms.txt)
