-
Notifications
You must be signed in to change notification settings - Fork 0
Support for TOML arrays #1
New issue
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
Comments
Can you say more specifically what feature you're requesting? The parser handles array-valued blocks already, and it's not clear to me whether this is about the CLI tool or the library, and what kind of API you'd like to see. It would be helpful if you can give a couple specific examples of what you want to do (ideally with a code snippet, even if that snippet doesn't work with the current API). |
Currently, Say you have the following toml: [[fruit]]
name = "apple"
[[fruit.variety]]
name = "red delicious"
[[fruit.variety]]
name = "granny smith"
Right now, you don't have an easy way (afaict) to access the toml array values à la |
There are a few tricky things to sort out to make a JSONpath-style API work for TOML. Looking just at this example, the TOML is equivalent to the JSON: {
"fruit": [
{
"name": "apple",
"variety": [
{
"name": "red delicious"
},
{
"name": "granny smith"
}
]
}
]
} So a JSONpath (or similar) expression like Anyway, taking it as written, you'd want For example, this TOML: [a]
[[a.b]]
id = 1
[[a.b]]
id = 2
[c]
[[a.b]]
id = 3 is valid, and represents the JSON {
"a": {
"b": [
{"id": 1},
{"id": 2},
{"id": 3}
]
},
"c": {}
} To resolve All that is of course quite achievable, but it's not a straightforward extension of the existing API—this would need a new API and probably some new types. It's not something I have a lot of time to invest in here—it might even want to be a separate package maybe. |
Uh oh!
There was an error while loading. Please reload this page.
As suggested by Cosmos Devs, I'm bringing here a feature request opened for Cosmos Confix.
cosmos/cosmos-sdk#21034
It would be nice if tomledit could parse arrays blocks.
Thanks in advance for any attention to this.
The text was updated successfully, but these errors were encountered: