Skip to main content

Squillify development is paused indefinitely. Read why, and discover what this experiment achieved. Read the story

MicroSkills Reference

JSON Repair

schema.repair_json

ProductionBounded custom (Class B)Deterministicstrictfastv1.0.0
File inputNo network

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

Note
We fix the mechanical faults that stop almost-JSON from parsing and hand back canonical JSON together with a named list of every fix we made.

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

IdempotentRetry safeStreaming supportedFile input supportedRequires external service

Capabilities

data-transformationparsing

Cost & billing

Flat rate per invocation

MetercallsBillable onsuccessCost per call1 credit

File handling

Accepts file_refProduces file_refMax input1.9 MBMax file size1.9 MB

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.

LimitValueLimited by
Maximum size per input file1.9 MiBSkill maximum

How we handle your data

Sensitive output possible
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.

Read the Microskill Data Handling Policy

Input schema

FieldTypeRequiredDescription
jsonstringNoText to repair, 1 to 2000000 characters. Required unless file_ref is provided.
file_refstringNoTenant-owned almost-JSON file reference; omit it to read json. When both are sent this one wins.
outputToFilebooleanNoForce a downloadable file result; omit it for false, which still switches to a file past 100000 bytes.

Output schema

FieldTypeRequiredDescription
jsonstringNoRepaired document re-serialized in canonical form with original key order; omit it when the result went to a file.
file_refstringNoStored-result file reference kept for ten minutes; omit it when the result is inline.
download_urlstringNoReady-to-use fetch link that expires with the file; omit it when the result is inline.
size_bytesintegerNoUTF-8 size of the stored result; omit it when the result is inline.
changedbooleanYesTrue when a fix was applied; false when the text already parsed and was only re-serialized.
repairsarrayYesFixes applied, 0 through 32 unique identifiers such as removed_trailing_comma, in application order.

API contract

POST /v1/execute
curl
curl -sS -X POST "$BASE/v1/execute" -H "Authorization: Bearer $KEY" -H 'Content-Type: application/json' -d '{"skillKey":"schema.repair_json","input":{"json":"{\"a\": 1,}"}}'
Integrations
TypeScript SDK
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

CodeHTTPRetryableDescription
VALIDATION_ERROR400NoThe request payload failed schema validation.
UNAUTHORIZED401NoMissing or invalid API key.
SKILL_NOT_ACCESSIBLE403NoThe API key is not granted access to this skill.
SKILL_NOT_AVAILABLE_FOR_PLAN403NoThis skill is not included in your current plan.
PLAN_ELIGIBILITY_UNAVAILABLE503YesPlan eligibility could not be decided. Retry after backoff.
SKILL_NOT_FOUND404NoThe requested skill or version does not exist.
TENANT_RATE_LIMITED429YesRequest rate limit exceeded. Retry after backoff.
QUOTA_EXCEEDED429YesPlan quota exhausted. Retryable once the quota period resets.
EXECUTION_TIMEOUT504YesExecution exceeded the allowed time budget.

Other limits

LimitValue
Recommended inline bytes32 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)

Request bodyjson
{
  "skillKey": "schema.repair_json",
  "input": {
    "json": "{'name': 'Alice', 'roles': ['admin', 'user',],}"
  }
}

Examples

Repair trailing comma and single quotes

Inputjson
{
  "json": "{'name': 'Alice', 'roles': ['admin', 'user',],}"
}
Expected outputjson
{
  "json": "{\"name\":\"Alice\",\"roles\":[\"admin\",\"user\"]}",
  "changed": true,
  "repairs": [
    "converted_single_quotes",
    "removed_trailing_comma"
  ]
}

Strip a markdown code fence

Inputjson
{
  "json": "```json\n{\"a\": 1}\n```"
}
Expected outputjson
{
  "json": "{\"a\":1}",
  "changed": true,
  "repairs": [
    "removed_code_fence"
  ]
}
  • 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

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.

Tags

jsontransformationcleanup