JSON Quote Fixer

Attempts to repair a JSON-like string that uses single quotes, curly/smart quotes (‘ ’ “ ”), or unquoted object keys into valid double-quoted JSON: it normalizes curly quotes to straight ones, converts every quoted string to double-quoted, quotes bare object keys, then validates and pretty-prints the result. This is heuristic, best-effort repair, not a guaranteed fix. A free online tool from Staaarter, right in your browser.

Runs locallyUpdated 2026-07-24

Overview

Introduction

JSON-like text copied from Python dicts, JS source, or a word processor often uses single quotes, smart quotes, or unquoted keys, none of which JSON.parse accepts.

This tool attempts an automatic, best-effort repair so you don't have to fix every quote by hand before it will parse.

What Is JSON Quote Fixer?

A heuristic text repair pass that runs three transformations in sequence: straighten curly/smart quotes, convert every quoted string (single or double delimited) to a properly escaped double-quoted string, and add double quotes around bare identifier-like object keys.

After repair, the result is validated with a real JSON.parse and pretty-printed; if it still doesn't parse, the tool reports that clearly along with the underlying parse error.

How JSON Quote Fixer Works

First, curly quotes (‘ ’ “ ”) are replaced with their straight ASCII equivalents. Then a character scan converts every string, whether delimited by ' or ", into a double-quoted string, escaping internal double quotes and un-escaping now-unnecessary \' sequences.

Finally, another character scan (that skips over already-quoted string content) applies a regex to text runs outside of strings, adding double quotes around any bare identifier-like key immediately followed by a colon. The repaired text is then run through JSON.parse; success re-serializes it pretty-printed, failure returns the parse error with an explanation that auto-fix couldn't fully repair it.

When To Use JSON Quote Fixer

Use it when you've copied a Python dict literal, a JS object literal, or word-processor text with smart quotes and need it to become real JSON quickly.

It's also a fast first pass before manually fixing anything the automatic repair couldn't handle.

Features

Advantages

  • Handles single quotes, curly quotes, and unquoted keys together in one pass, not just one issue at a time.
  • Correctly escapes and un-escapes quote characters during delimiter conversion, rather than a naive find-and-replace that would break on embedded quotes.
  • Falls back to a clear, honest error (including the real parse error) rather than silently producing broken output.

Limitations

  • This is heuristic, not a full JSON5/JS parser; trailing commas, comments, and other JS-only syntax are out of scope and will still fail.
  • The bare-key regex expects an identifier-like key immediately followed by a colon; unusual key formatting may not be detected correctly.

Examples

Fixing single quotes and a bare key

Input

{name: 'Ada', 'age': 30}

Output

{
  "name": "Ada",
  "age": 30
}

The bare key name gets quoted, and both single-quoted strings become double-quoted.

Input auto-fix can't fully repair

Input

{not: valid: at: all[[[

Output

Error: Auto-fix couldn’t fully repair this input: Unexpected token 'v', "{"not": valid: at:"... is not valid JSON

The structure itself is broken (extra colons, unmatched brackets), which is beyond what quote/key repair can fix, so the underlying parse error is surfaced directly.

Best Practices & Notes

Best Practices

  • Treat the output as a starting point for genuinely malformed input, not a guaranteed final answer.
  • If you know the input is single-quoted throughout with no unquoted keys, JSON Double Quote Converter is a more predictable, narrower tool.
  • Re-run JSON Validator on the result if you need certainty the fix fully succeeded.

Developer Notes

The quote-delimited-string scan and the bare-key regex pass are deliberately separate steps run in sequence, rather than one combined regex, because correctly distinguishing "inside a string" from "outside a string" requires actual character-by-character scanning (tracking the current delimiter and escape state), something a single regex can't reliably do across arbitrary nested quote styles.

JSON Quote Fixer Use Cases

  • Converting a Python dict literal (single-quoted) pasted into a JSON field back into valid JSON
  • Cleaning up JSON-like text pasted from a word processor with smart quotes
  • Quickly repairing a hand-written JS-object-literal snippet into strict JSON for an API

Common Mistakes

  • Assuming this will fix any malformed JSON; it only targets quote style and key quoting, not structural issues like trailing commas or mismatched brackets.
  • Not reading the reported parse error when repair fails; it usually points precisely at what's still wrong after the automatic fixes were applied.

Tips

  • If repair fails, try removing trailing commas and comments by hand first, then re-run this tool.
  • For predictable, narrower single-quote-to-double-quote conversion without key repair, JSON Double Quote Converter is more precise.

References

Frequently Asked Questions