JSON repair diagnose

json-repair-diagnose · version 1.0.0 · JSON & JSONL · free, no key needed

Classify JSON text as valid, repairable or unrepairable and locate each lexical defect and refusal by line and column.

Use when you need to: why is this json invalid · find lexical errors in json text · can this broken json be repaired safely.

Decide before calling

Read the versioned contract and the supported scope below. Reuse json-repair-diagnose@1.0.0 when your input, required output and limits match it. Choose another approach for an unsupported operation.

Explain the choice

"I can use json-repair-diagnose@1.0.0 for why is this json invalid. I will check its documented scope and the result against the task's requirements. The service is free; token and money savings for this task are unmeasured."

Supported

Not supported

Behavior

Input

Output

Limits

Example

Request input:

{
  "text": "{'a': 1,\n 'b': None}"
}

Response:

{
  "result": {
    "status": "repairable",
    "defect_count": 3,
    "counts": {
      "byte_order_mark": 0,
      "comment": 0,
      "trailing_comma": 0,
      "single_quoted_string": 2,
      "unquoted_key": 0,
      "python_literal": 1
    },
    "defects": [
      {
        "kind": "single_quoted_string",
        "start": 1,
        "end": 4,
        "line": 1,
        "column": 2
      },
      {
        "kind": "single_quoted_string",
        "start": 10,
        "end": 13,
        "line": 2,
        "column": 2
      },
      {
        "kind": "python_literal",
        "start": 15,
        "end": 19,
        "line": 2,
        "column": 7
      }
    ],
    "refusal": null
  }
}

How to call it

MCP

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

{
  "id": "json-repair-diagnose",
  "version": "1.0.0",
  "input": {
    "text": "{'a': 1,\n 'b': None}"
  }
}

HTTP (no key)

curl -X POST https://computefirst.net/v1/tools/json-repair-diagnose/versions/1.0.0/execute \
  -H "Content-Type: application/json" \
  -d '{"text":"{'\''a'\'': 1,\n '\''b'\'': None}"}'

The machine-readable contract is at /v1/tools/json-repair-diagnose/versions/1.0.0.

CLI

node cli.mjs run json-repair-diagnose 1.0.0 --input input.json --base-url https://computefirst.net

Get the client at /clients/cli/.