1

我可以将 TOML 表放入 TOML 变量中,然后在另一个 TOML 表中使用该变量吗?我想像这样复制 JSON 输出:

group1 = {
    "key1": "value1"
    "key2": "value2"
    "key3": {
        "key1": "value4"
        "key2": "value5"
        "key3": "value6"
    }
}

group2 = {
    "key1": "value1"
    "key2": "value2"
    "key3": {
        "key1": "value4"
        "key2": "value5"
        "key3": "value6"
    }
}

mainGroup = {
    "key1": "value1"
    "key2": "value2"
    "key3": group1
    "key4": {
        "key1": "value3"
        "key2": "value3"
        "key3": group2
    }
    "key5": {
        "key1": group1
        "key2": group2
    }
}
4

1 回答 1

1

Toml 不像 Yaml 那样支持引用。

可读性和易于实现是 Toml 的开发人员将其排除在标准之外的一些原因。

可以在此处阅读有关此主题的有趣讨论:

https://github.com/toml-lang/toml/issues/77

于 2020-12-25T23:26:51.420 回答