We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
a1 = {"a": [{"name": "bob", "kwargs": {}}]} print(toml.dumps(a1))
What I got
[[a]] name = "bob"
I am expecting to have
[[a]] name = "bob" [[a.kwargs]]
Latest toml and python=3.12
Not sure if this is the intended behavior
The text was updated successfully, but these errors were encountered:
I don't think this one can be put down to toml's strict TOML 0.5.0 support. The 0.5.0 ABNF toml-0.5.0.zip specially caters for empty inline tables:
toml
inline-table-keyvals = [ inline-table-keyvals-non-empty ]
This isn't the only issue with toml's code for array tables - it needs work. See #439 In the mean time, other toml writers are available.
Reproduced:
>>> import tomli_w, tomlkit, toml_tools, toml >>> a1 = {"a": [{"name": "bob", "kwargs": {}}]} >>> for module in (tomli_w, tomlkit, toml_tools, toml): ... print(module.__name__); print(module.dumps(a1)) ... tomli_w a = [ { name = "bob", kwargs = {} }, ] tomlkit [[a]] name = "bob" [a.kwargs] toml_tools a = [ { name = "bob", kwargs = {} }, ] toml [[a]] name = "bob"
Sorry, something went wrong.
Having said that, toml will correctly parse a sub-array-table, and give your intended output:
>>> a2 = {"a": [{"name": "bob", "kwargs": [{}]}]} >>> for module in (tomli_w, tomlkit, toml_tools, toml): ... print(module.__name__); print(module.dumps(a2)) ... tomli_w [[a]] name = "bob" kwargs = [ {}, ] tomlkit [[a]] name = "bob" [[a.kwargs]] toml_tools [[a]] name = "bob" kwargs = [ {}, ] toml [[a]] name = "bob" [[a.kwargs]]
No branches or pull requests
What I got
I am expecting to have
Latest toml and python=3.12
Not sure if this is the intended behavior
The text was updated successfully, but these errors were encountered: