JSON Repair
schema.repair_json
Overview
You send text that was meant to be JSON and we fix the mechanical things that keep it from parsing: trailing commas, single or curly quotes, unquoted keys, comments, Python's True and None, a markdown code fence, a JSONP callback wrapper, an ellipsis someone left in place of the rest of a list, and a document that simply stops mid-way. You get back canonical JSON plus a list naming each fix. We never change what your strings say and never invent a value, so if the text cannot be repaired by rule we tell you instead of guessing. Accepts file input via file_ref — no need to extract file content first.
Models and lenient tools produce almost-JSON all day long, and a strict parser rejects the whole document over one stray comma. Fixing it by rule is faster and far safer than asking a model to rewrite the payload, which risks changing your data.
Reliability
Deterministic: the same text always produces the same repaired output and the same list of fixes. Your string contents survive untouched and no value is ever invented, so a truncated document is closed rather than completed — which means the result can be valid JSON that is still missing data your source had. When we have to rewrite the text, nesting beyond 50 levels is refused as pathological. We reject the call, and an unchanged retry will not help, when neither json nor file_ref is present, when the text runs past 2000000 characters, or when no sequence of mechanical fixes yields valid JSON.
Context footprint
Input is capped at 2000000 characters inline or 2000000 bytes by reference; results over 100000 bytes come back as a file kept for ten minutes rather than inline, and you can ask for that from the start with outputToFile. A successful call costs 1 execution credit.
When to use it
When a parse fails on something mechanical — a comma, a quote style, a comment, a wrapper, an ellipsis, or a truncated tail — or as the step that clears another skill's malformed-JSON failure before you call it again.
When the text already parses and what you actually want is validation or a schema, or when the damage is beyond mechanical repair, such as a key with no value at all.
Scope
Non-goals
- We never check the result against a schema — that is schema.validate_json
- We never work out what the document should look like — that is schema.infer_json_schema
- We never repair broken character encoding or scrambled text
- We never guess a missing value; unrepairable input is reported, not invented
Properties
Capabilities
Cost & billing
Flat rate per invocation
File handling
File limits
Constraints this skill applies to your input and generated files. The “Limited by” column shows the static source of each cap; none of these can be raised by upgrading your plan.
| Limit | Value | Limited by |
|---|---|---|
| Maximum size per input file | 1.9 MiB | Skill maximum |
How we handle your data
What this means
This skill may receive sensitive content and may return submitted, transformed, extracted, or reformatted content.
Squillify guarantees
- Runs inside Squillify
- This skill runs inside Squillify.
- Payloads are not sent to an external service by this skill.
- Squillify does not permanently store submitted payloads.
- Telemetry records metadata only, not submitted content.
- Submitted payloads are not used for training.
- Submitted payloads are not reviewed by humans.
- This skill does not target sensitive data.
- The response may contain submitted or transformed content.
Your responsibility
Squillify does not determine whether submitted content is sensitive. Your application is responsible for deciding what data it is allowed to submit. Your application is responsible for securing the response.
Input schema
| Field | Type | Required | Description |
|---|---|---|---|
| json | string | No | Text to repair, 1 to 2000000 characters. Required unless file_ref is provided. |
| file_ref | string | No | Tenant-owned almost-JSON file reference; omit it to read json. When both are sent this one wins. |
| outputToFile | boolean | No | Force a downloadable file result; omit it for false, which still switches to a file past 100000 bytes. |
Output schema
| Field | Type | Required | Description |
|---|---|---|---|
| json | string | No | Repaired document re-serialized in canonical form with original key order; omit it when the result went to a file. |
| file_ref | string | No | Stored-result file reference kept for ten minutes; omit it when the result is inline. |
| download_url | string | No | Ready-to-use fetch link that expires with the file; omit it when the result is inline. |
| size_bytes | integer | No | UTF-8 size of the stored result; omit it when the result is inline. |
| changed | boolean | Yes | True when a fix was applied; false when the text already parsed and was only re-serialized. |
| repairs | array | Yes | Fixes applied, 0 through 32 unique identifiers such as removed_trailing_comma, in application order. |
API contract
POST /v1/executecurl -sS -X POST "$BASE/v1/execute" -H "Authorization: Bearer $KEY" -H 'Content-Type: application/json' -d '{"skillKey":"schema.repair_json","input":{"json":"{\"a\": 1,}"}}'import { Squillify } from "@squillify/sdk";
const sq = new Squillify({ apiKey: process.env.SQUILLIFY_API_KEY });
const { output } = await sq.execute("schema.repair_json", {"json":"{'name': 'Alice', 'roles': ['admin', 'user',],}"});Errors
| Code | HTTP | Retryable | Description |
|---|---|---|---|
| VALIDATION_ERROR | 400 | No | The request payload failed schema validation. |
| UNAUTHORIZED | 401 | No | Missing or invalid API key. |
| SKILL_NOT_ACCESSIBLE | 403 | No | The API key is not granted access to this skill. |
| SKILL_NOT_AVAILABLE_FOR_PLAN | 403 | No | This skill is not included in your current plan. |
| PLAN_ELIGIBILITY_UNAVAILABLE | 503 | Yes | Plan eligibility could not be decided. Retry after backoff. |
| SKILL_NOT_FOUND | 404 | No | The requested skill or version does not exist. |
| TENANT_RATE_LIMITED | 429 | Yes | Request rate limit exceeded. Retry after backoff. |
| QUOTA_EXCEEDED | 429 | Yes | Plan quota exhausted. Retryable once the quota period resets. |
| EXECUTION_TIMEOUT | 504 | Yes | Execution exceeded the allowed time budget. |
Other limits
| Limit | Value |
|---|---|
| Recommended inline bytes | 32 KiB |
Limitations
- We never check the result against a schema — that is schema.validate_json
- We never work out what the document should look like — that is schema.infer_json_schema
- We never repair broken character encoding or scrambled text
- We never guess a missing value; unrepairable input is reported, not invented
- Checking data against a schema (schema.validate_json)
- Working out a schema from examples (schema.infer_json_schema)
- Recovering text that is corrupted or in the wrong encoding
How to call
POST /v1/execute (requires authentication)
{
"skillKey": "schema.repair_json",
"input": {
"json": "{'name': 'Alice', 'roles': ['admin', 'user',],}"
}
}Examples
Repair trailing comma and single quotes
{
"json": "{'name': 'Alice', 'roles': ['admin', 'user',],}"
}{
"json": "{\"name\":\"Alice\",\"roles\":[\"admin\",\"user\"]}",
"changed": true,
"repairs": [
"converted_single_quotes",
"removed_trailing_comma"
]
}Strip a markdown code fence
{
"json": "```json\n{\"a\": 1}\n```"
}{
"json": "{\"a\":1}",
"changed": true,
"repairs": [
"removed_code_fence"
]
}Recommended use cases
- Fix output from a lenient tool that left trailing commas or comments behind
- Clean up a model's answer: drop the surrounding code fence and close a reply that stopped mid-object or mid-string
- Drop the ellipsis a model used to abbreviate a long list
- Unwrap a callback envelope back into plain JSON
- Clear another skill's malformed-JSON failure before you retry it
- Bring a hand-edited config file back to strict JSON
Avoid for
- Checking data against a schema (schema.validate_json)
- Working out a schema from examples (schema.infer_json_schema)
- Recovering text that is corrupted or in the wrong encoding
Related skills
Composable with
Safety & privacy
- Runs without calling any external service.
- Your payloads are never stored permanently.
- Telemetry captures metadata only — never your payload contents.
- We never train models on your payloads.
- No human reviews your payloads.