Repair JSON and match it to a schema

Turn broken or wrapped JSON (typical language-model output) into valid JSON, list every repair, and optionally coerce and validate it against a JSON Schema.

CHF 0.002 / callCall itTry it
Platen printing press, patent model, 1850
Platen printing press, patent model1850

Details

Repairs: Markdown code fences, text before or after the JSON, comments, trailing or missing commas, single or curly quotes, unquoted keys, Python True/False/None, NaN/Infinity, raw line breaks in strings, and output cut off mid-way.

With a schema: converts "42" to 42 or "yes" to true where the schema asks, fixes key case and enum case, wraps a single value in an array, can add defaults and drop unknown keys; then returns validation errors with paths.

Limits: text up to 1 MB. Schema keywords: type, properties, required, items, prefixItems, enum, const, ranges, lengths, pattern, format, anyOf/oneOf/allOf/not, $ref to $defs.

Price: CHF 0.002 per call (first 100 calls per day free).

Example: {"text":"Sure! ```json\n{name: 'Ada', age: '36',}\n```","schema":{"type":"object","properties":{"age":{"type":"integer"}}}} → {"data":{"name":"Ada","age":36},"valid":true}.

Call it

REST
curl -X POST https://api.tausendwerk.xyz/v1/repair-json \
  -H "Content-Type: application/json" \
  -d '{"text":"Sure! ```json\n{name: 'Ada', age: '36',}\n```","schema":{"type":"object","properties":{"age":{"type":"integer"}}}}'
MCP tool name
repair_json

After the free 100 calls per day, add a key: Authorization: Bearer tw_live_…. Pricing

Try it

Runs against the live API with the free allowance.

Input schema JSON Schema
{
  "type": "object",
  "additionalProperties": false,
  "required": [
    "text"
  ],
  "properties": {
    "text": {
      "type": "string",
      "maxLength": 1000000,
      "description": "The broken JSON or model output."
    },
    "schema": {
      "type": "object",
      "description": "Optional JSON Schema to coerce and validate against."
    },
    "coerce": {
      "type": "boolean",
      "default": true,
      "description": "Fix types toward the schema. Default true."
    },
    "apply_defaults": {
      "type": "boolean",
      "default": false,
      "description": "Add missing properties that have a default."
    },
    "strip_unknown": {
      "type": "boolean",
      "default": false,
      "description": "Drop keys the schema forbids (additionalProperties: false)."
    }
  },
  "examples": [
    {
      "text": "Sure! ```json\n{name: 'Ada', age: '36',}\n```",
      "schema": {
        "type": "object",
        "properties": {
          "age": {
            "type": "integer"
          }
        }
      }
    }
  ]
}

More in JSON