相关疑难解决方法(0)

TOML 是否支持对象/表的嵌套数组?

我想从 TOML 文件生成 JSON。JSON 结构应该是这样的,在对象数组中包含对象数组:

{
    "things": [
        {
            "a": "thing1",
            "b": "fdsa",
            "multiline": "Some sample text."
        },
        {
            "a": "Something else",
            "b": "zxcv",
            "multiline": "Multiline string",
            "objs": [  // LOOK HERE
                { "x": 1},
                { "x": 4 },
                { "x": 3 }
            ]
        },
        {
            "a": "3",
            "b": "asdf",
            "multiline": "thing 3.\nanother line"
        }
    ]
}
Run Code Online (Sandbox Code Playgroud)

我有一些类似于下面示例的 TOML,但它似乎不适用于该objs部分。

name = "A Test of the TOML Parser"

[[things]]
a = "thing1"
b = "fdsa"
multiLine = """
Some …
Run Code Online (Sandbox Code Playgroud)

json toml

5
推荐指数
2
解决办法
9268
查看次数

标签 统计

json ×1

toml ×1