JSON to DICT

This free online converter switches between JSON and Python dict format, repairs single quotes, trailing commas and other common syntax issues, and can format, minify or escape either one.

Large integers and long decimals keep their exact digits — no rounding and no scientific notation.

Help:

  • Paste JSON or a Python dict into the editor, then click "To DICT" or "To JSON" — the result replaces the original text.
  • Single-quoted dicts, trailing commas and unquoted keys are repaired automatically. Minify and Escape need valid JSON or a double-quoted dict.
  • Conversions and formatting preserve numeric precision; Format uses a fixed 5-space indent.

Features:

  • JSON to DICT: Replaces true, false and null with True, False and None; quotes stay double-quoted
  • DICT to JSON: Converts True/False/None and single-quoted dicts into standard JSON
  • Format: Re-indents JSON or DICT with 5 spaces and repairs common syntax errors
  • Minify: Strips whitespace and line breaks down to a single line
  • Escape: Escapes the whole block for use inside a string literal
  • Numeric precision: Large integers and long decimals are kept exactly as written
  • Auto-repair: Fixes single quotes, trailing commas, unquoted keys and outer wrapping quotes

FAQ:

  • Q: Can I convert a Python dict that uses single quotes?
    A: Yes. Input like {'a': True} is repaired and turned into standard double-quoted JSON. Trailing commas, unquoted keys and a whole value wrapped in outer quotes are handled too. If the text still cannot be parsed, you'll get a format error instead.
  • Q: Does "To DICT" switch the quotes to single quotes?
    A: No. It only swaps true, false and null for True, False and None. Keys and strings keep their double quotes, which Python accepts, so the output can be pasted straight into Python code as a dict literal.
  • Q: Will true or None inside a string value be changed?
    A: Yes. Conversion replaces those words as text rather than parsing the data into an object first, so a value like "true and None" becomes "True and None". Check any strings containing these words before reusing the output.
  • Q: Do large numbers lose precision?
    A: No. Numbers are kept exactly as written, including 30-digit integers and long decimals — no truncation and no scientific notation. That makes it safe for high-precision IDs and monetary fields.
  • Q: Why do Minify and Escape reject my single-quoted dict?
    A: Those two buttons require valid JSON or a double-quoted dict and do not repair single quotes. Click "To JSON" first, then minify or escape. Format, on the other hand, handles single-quoted dicts directly.
  • Q: What happens to variables in a dict, such as foo?
    A: They are not evaluated. A bare identifier like foo is wrapped as a string, so {'a': foo} becomes {"a": "foo"}. Evaluate variables or other non-literal expressions in Python first, then paste the resulting values.

Common uses:

  • Converting JSON data to DICT format for use in Python development
  • Converting Python dict data to JSON before sending it to an API
  • Quickly swapping True/False/None and true/false/null
  • Turning API responses with high-precision IDs into Python dicts without losing digits
  • Cleaning up single-quoted dicts and stray commas copied from logs or config files
  • Minifying or escaping JSON/DICT for request parameters and string literals