# JSON Array Sort By Key

> JSON Array Sort By Key is a paid API for AI agents from api.delx.ai, paid per call via x402, $0.001/call, status unknown (last checked 2026-09-15).

Sorts an array of JSON objects by a specified top-level key, ascending or descending, returning the reordered array with counts and a versioned result contract.

## Facts

- Endpoint: POST https://api.delx.ai/api/v1/x402/json-array-sort-by-key
- Price: $0.001/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-15
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/json-array-sort-by-key-b7024b1e
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_9GHjYkVVeObOW0uTOKivR

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-array-sort-by-key-b7024b1e -d '<json body>'
```

Example prompt: Sort this list of product objects by the 'price' key in descending order: [{"name":"Widget","price":12},{"name":"Gadget","price":7},{"name":"Doohickey","price":25}].

## When to prefer this

Choose this endpoint when you need a deterministic, in-memory, serverless sort of a JSON array by a top-level object key without standing up any infrastructure or writing code. It is ideal for pre-processing structured data before handing it to a downstream tool with a strict ordering contract. Prefer it over writing a sort routine in an agent's code execution step when you want a clean, versioned, auditable result contract. Not suitable for nested-key sorting, arrays larger than 256 items, or complex multi-key sort requirements.

## Known failure modes

- Key not found in one or more objects — items with missing key may sort inconsistently or return an error
- Array exceeds 256 items — request rejected with validation error
- Object contains more than 128 properties — may be rejected
- Non-comparable mixed types under the sort key (e.g. string vs number) — may produce undefined ordering or error
- Malformed JSON array input — request rejected
- Payment failure via x402 — request not processed

## How this service works

JSON Array Sort By Key: JSON Array Sort By Key sorts object rows by a selected top-level key from bounded caller-supplied values without an external provider. Call JSON Array Sort By Key before an agent hands structured data or a batch plan to a downstream tool with a stricter contract. Returns the bounded transformation or validation finding with counts, normalized values, and a versioned result contract for JSON Array Sort By Key as versioned deterministic JSON. Price: $0.001 USDC via x402 on…

## Output

Returns the sorted JSON array of objects ordered by the specified top-level key (ascending or descending), along with item counts, normalized values, and a versioned deterministic result contract. The transformation is computed in-memory without data retention.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "key": {
   "type": "string",
   "maxLength": 8192,
   "description": "Key supplied to JSON Array Sort By Key; used only for this bounded calculation and processed in memory without retention."
  },
  "items": {
   "type": "array",
   "items": {
    "type": "object",
    "maxProperties": 128,
    "additionalProperties": true
   },
   "maxItems": 256,
   "description": "Items supplied to JSON Array Sort By Key; used only for this bounded calculation and processed in memory without retention."
  },
  "descending": {
   "type": "boolean",
   "description": "Descending supplied to JSON Array Sort By Key; used only for this bounded calculation and processed in memory without retention."
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "result": {
   "key": "id",
   "items": [
    {
     "id": 1
    },
    {
     "id": 2
    }
   ]
  },
  "schema": "delx/util-json-array-sort-by-key/v1",
  "status": "pass",
  "evidence": {
   "retained": false,
   "input_sha256": "bf681df4606cba8b0ec23d87bda8e34c27fbf446a8b5b0d57f064b3afa47afd5",
   "external_calls": 0
  },
  "operation": "data_batch:json_array_sort_by_key"
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/json-array-sort-by-key-b7024b1e/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from api.delx.ai](https://www.zero.xyz/host/api.delx.ai/llms.txt)
