JSON array group count

json-array-group-count · version 1.0.0 · JSON & JSONL · free, no key needed

Group an array of JSON objects by exact keys and return the count.

Use when you need to: json array group count · count json array by keys · frequency map json array.

Supported

Not supported

Behavior

Input

Output

Limits

Example

Request input:

{
  "array": [
    {
      "id": 1,
      "v": "A"
    },
    {
      "id": 2,
      "v": "B"
    },
    {
      "id": 1,
      "v": "C"
    }
  ],
  "keys": [
    "id"
  ]
}

Response:

{
  "result": {
    "result": [
      {
        "id": 1,
        "count": 2
      },
      {
        "id": 2,
        "count": 1
      }
    ],
    "groups_count": 2
  }
}

How to call it

MCP

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

{
  "id": "json-array-group-count",
  "version": "1.0.0",
  "input": {
    "array": [
      {
        "id": 1,
        "v": "A"
      },
      {
        "id": 2,
        "v": "B"
      },
      {
        "id": 1,
        "v": "C"
      }
    ],
    "keys": [
      "id"
    ]
  }
}

HTTP (no key)

curl -X POST https://computefirst.net/v1/tools/json-array-group-count/versions/1.0.0/execute \
  -H "Content-Type: application/json" \
  -d '{"array":[{"id":1,"v":"A"},{"id":2,"v":"B"},{"id":1,"v":"C"}],"keys":["id"]}'

The machine-readable contract is at /v1/tools/json-array-group-count/versions/1.0.0.

CLI

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

Get the client at /clients/cli/.