The converter parses the object literal with JSON5, then prints the result with stringifyPyDict. null becomes None, true and false become True and False, arrays become Python lists, and nested objects become dictionaries.
Curly brace mode is the safer choice for arbitrary keys because it can quote every dictionary key. dict mode is best for simple identifier-like keys, and the output remains a data literal rather than a runnable Python module.
Common questions and answers about this topic.
JSON5-style JavaScript object data can use quoted or unquoted keys, null, true, false, comments, and trailing commas. Python dictionaries use quoted keys, None instead of null, and True/False instead of true/false. JavaScript-only executable values such as functions and undefined must be removed before conversion.
Curly brace output uses the standard {'key': 'value'} syntax, which is the most common Python dict format. The dict() constructor output uses dict(key='value') syntax, which can be more readable for simple string keys but does not support keys with spaces or non-string keys.
Yes, you can choose between single quotes ('key') and double quotes ("key") for dictionary keys. This lets you match the quoting convention used in your project's codebase.
No, the JS object to Python dict conversion is handled entirely by JavaScript in your browser. Your JavaScript source code remains on your device and is never shared with any server.