JSON Fixer avatar

JSON Fixer

Pricing

from $0.50 / 1,000 json cleaneds

Go to Apify Store
JSON Fixer

JSON Fixer

Repairs malformed JSON such as LLM output: strips Markdown fences, fixes curly quotes and trailing commas, and optionally validates the result against a JSON Schema.

Pricing

from $0.50 / 1,000 json cleaneds

Rating

0.0

(0)

Developer

林 吴

林 吴

Maintained by Community

Actor stats

0

Bookmarked

2

Total users

1

Monthly active users

14 hours ago

Last modified

Categories

Security

Limited permissions

Share

Repair malformed JSON from LLMs, logs, and hand-edited config files. Paste raw text and get valid, parsed JSON back.

What it does

  • Strips Markdown code fences (for example, json-fenced blocks) and surrounding prose
  • Replaces curly quotes (“ ” ‘ ’) with straight quotes
  • Removes trailing commas before } and ]
  • Removes UTF-8 BOM and whitespace noise
  • Supports both JSON objects and top-level arrays
  • Optionally validates the result against a JSON Schema and reports field-level errors

Input

FieldTypeRequiredDescription
raw_textstringYesRaw text that may contain Markdown, curly quotes, trailing commas, or missing brackets
expected_schemastringNoJSON Schema (as a JSON string) used to validate the cleaned result

Example input:

{
"raw_text": "Here is the result:\n{\"name\": \"Lin\", \"tags\": [\"json\", \"cleanup\",], \"quote\": “hello”}",
"expected_schema": "{\"type\":\"object\",\"required\":[\"name\"]}"
}

Output

One item is pushed to the default dataset:

{
"success": true,
"cleaned_json": {
"name": "Lin",
"tags": ["json", "cleanup"],
"quote": "hello"
},
"errors": []
}

If parsing or schema validation fails, success is false, cleaned_json is {}, and errors contains the parser or validation messages.

Pricing

Pay per event. The $0.01 charge applies only when the JSON is successfully repaired and parsed. Failed attempts are not charged the repair fee, but standard start and dataset events still apply.

Use cases

  • Cleaning structured output from LLM APIs before downstream processing
  • Fixing JSON copied from chat, docs, or logs
  • Validating scraped data against an expected schema
  • Preparing malformed config snippets for automation pipelines

Notes

This Actor performs deterministic string repair; it does not call any external AI model, so results are fast and reproducible.