Toml: please consider support [key]=value

Created on 25 Jan 2021  路  2Comments  路  Source: toml-lang/toml

such as:

name="allen"
[obj]
prop1=88
prop2="sss"
[age]=9

it equals the json:
{"name": "allen", "age": 9, "obj": {"prop1": 88,"prop2": "sss"}}

Most helpful comment

Top-level key/value pairs belong at the top of the document. Attempts to define them elsewhere have been discussed many times before, and have always been rejected, because we do not allow tables to be defined in more than one place.

You may want to bring this up with the consuming app's developer. It's bad practice to put such KVPs in the root table.

A better solution could be an explicit [override] table (or aptly-named subtable) that you can append to your existing config. Your app could read its contents and apply them as you intended.

Again, talk with your developer. They may have a better option than relying on configuration injection to get what you want.

All 2 comments

Top-level key/value pairs belong at the top of the document. Attempts to define them elsewhere have been discussed many times before, and have always been rejected, because we do not allow tables to be defined in more than one place.

You may want to bring this up with the consuming app's developer. It's bad practice to put such KVPs in the root table.

A better solution could be an explicit [override] table (or aptly-named subtable) that you can append to your existing config. Your app could read its contents and apply them as you intended.

Again, talk with your developer. They may have a better option than relying on configuration injection to get what you want.

I have nothing to add beyond what @eksortso has said. :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Suhoy95 picture Suhoy95  路  4Comments

keiichiiownsu12 picture keiichiiownsu12  路  4Comments

uvtc picture uvtc  路  3Comments

clarfonthey picture clarfonthey  路  4Comments

ChristianSi picture ChristianSi  路  3Comments