Rescue a JSON payload
rescue_payloadRepair a malformed JSON or API payload so it matches a required schema. Use when a request, webhook, or tool output was rejected for schema validation errors: wrong types, a null where an array or object belongs, a forbidden extra property, or mismatched keys between two APIs. Deterministic repairs only. No semantic guessing. Refuses instead of inventing a value, and returns an exact change manifest plus a signed receipt so a silent 'fix' can never pass downstream unrecorded.
Give it the payload that was rejected and the JSON Schema it failed. It returns one of: VALID the payload already conformed; nothing changed REPAIRED safely repaired; the returned payload satisfies the schema CANNOT_REPAIR no safe repair exists; repaired_payload is null on purpose INVALID_SCHEMA the schema is malformed or uses an unsupported keyword ERROR bad request, or a size/depth limit was exceeded
It repairs structure only: unambiguous type coercion, null to empty array or object, removing a property the contract forbids, renaming a key when an explicit mapping rule is supplied, and trimming whitespace that is blocking validation.
It will NOT invent a value. A missing required field, an ambiguous number like "1,234.00", an identifier like "007" that would lose its leading zeros, or a date like "09/06/2026" whose day/month order is unknown all return CANNOT_REPAIR with a stable reason code rather than a guess.
No language model is involved. The same input always produces the same output and the same receipt id.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| schema | Yes | The JSON Schema the payload must satisfy. A supported subset; unsupported keywords are rejected, never ignored. | |
| payload | Yes | The JSON document that failed downstream. Any JSON value. | |
| mappings | No | Optional explicit key renames, e.g. {"custId": "customer_id"}. Field equivalence is NEVER inferred without a rule here. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | No | ||
| status | Yes | ||
| changes | No | Every repair applied, with a JSON path. | |
| receipt | No | Hashes and a signature. No payload content. | |
| problems | No | Every blocking issue, with a stable reason code. | |
| receipt_id | No | ||
| reason_code | No | ||
| schema_valid | Yes | ||
| original_hash | No | ||
| repaired_hash | No | ||
| repaired_payload | No | Null when status is CANNOT_REPAIR. |