JSON array sort objects

json-array-sort-objects · version 1.0.0 · JSON & JSONL · free, no key needed

Stably sort an array of objects by explicit string keys using UTF-16 lexicographic order.

Use when you need to: json array sort objects · sort json objects by keys · stable sort object array.

Supported

Not supported

Behavior

Input

Output

Limits

Example

Request input:

{
  "items": [
    {
      "team": "b",
      "name": "Ada"
    },
    {
      "team": "a",
      "name": "Zoe"
    },
    {
      "team": "a",
      "name": "Ada"
    }
  ],
  "keys": [
    "team",
    "name"
  ]
}

Response:

{
  "result": {
    "items": [
      {
        "team": "a",
        "name": "Ada"
      },
      {
        "team": "a",
        "name": "Zoe"
      },
      {
        "team": "b",
        "name": "Ada"
      }
    ]
  }
}

How to call it

MCP

Connect https://computefirst.net/mcp (setup), then call execute with:

{
  "id": "json-array-sort-objects",
  "version": "1.0.0",
  "input": {
    "items": [
      {
        "team": "b",
        "name": "Ada"
      },
      {
        "team": "a",
        "name": "Zoe"
      },
      {
        "team": "a",
        "name": "Ada"
      }
    ],
    "keys": [
      "team",
      "name"
    ]
  }
}

HTTP (no key)

curl -X POST https://computefirst.net/v1/tools/json-array-sort-objects/versions/1.0.0/execute \
  -H "Content-Type: application/json" \
  -d '{"items":[{"team":"b","name":"Ada"},{"team":"a","name":"Zoe"},{"team":"a","name":"Ada"}],"keys":["team","name"]}'

The machine-readable contract is at /v1/tools/json-array-sort-objects/versions/1.0.0.

CLI

node cli.mjs run json-array-sort-objects 1.0.0 --input input.json --base-url https://computefirst.net

Get the client at /clients/cli/.