Use this Python dict to TOML converter when you need to turn Python-style configuration data into TOML tables for pyproject.toml, Cargo.toml, or service config files. It parses supported dict syntax, optionally sorts keys recursively, and serializes the result with @iarna/toml. Nested dictionaries become TOML tables, while lists and tuples become TOML arrays when their values fit TOML types.
Python None has no direct TOML value, and the serializer omits null keys or array items. The browser-side parser does not execute Python expressions, so variables, imports, comprehensions, and function calls must be replaced with literal values before converting the dict to TOML.
Common questions and answers about this topic.
A Python dictionary is an in-memory data structure using curly braces and supporting Python-specific types like None and tuples. TOML (Tom's Obvious Minimal Language) is a configuration file format designed to be easy to read, commonly used for pyproject.toml, Cargo.toml, and other project configuration files.
The converter supports standard Python dictionary literals, including single-quoted and double-quoted strings, numeric keys and values, None, True, False, nested dictionaries, lists, and tuples. It parses literal syntax directly and does not run arbitrary Python code, so variables, imports, comprehensions, and function calls should be replaced with plain values first.
Yes, the sort keys dropdown enables you to alphabetically order all TOML table keys (A to Z) or preserve the original key sequence from your Python dictionary. Sorting applies recursively across nested TOML tables, which is useful for pyproject.toml-style configuration files.
No, the Python dict to TOML conversion is performed entirely in your browser using JavaScript. Your Python dictionary data stays on your device and is never uploaded to any server.