kenany / json2toml

Convert JSON to TOML
MIT License
15 stars 5 forks source link

Nested Arrays of Objects don't work #182

Open justinliow opened 1 year ago

justinliow commented 1 year ago

Example

 {
    "topLevel": [{
            "objectLevel": ["a", "b"],
            "arrayOfObjs": []
        },
        {
            "objectLevel": ["c"],
            "arrayOfObjs": [{
                "obj_a": "obj_a_val",
                "obj_b": "obj_b_val"
            }]
        }
    ]
}

should be represented in TOML as


[[topLevel]]
objectLevel = [ "a", "b" ]
arrayOfObjs = [ ]

[[topLevel]]
objectLevel = [ "c" ]

  [[topLevel.arrayOfObjs]]
  obj_a = "obj_a_val"
  obj_b = "obj_b_val"

json2toml returns the following instead

[[topLevel]]
arrayOfObjs = []
objectLevel = ["a","b"]
[[topLevel]]
[[arrayOfObjs]]
obj_a = "obj_a_val"
obj_b = "obj_b_val"
objectLevel = ["c"]
yanu23 commented 8 months ago

Are you fixing this?

kenany commented 8 months ago

I tried during the bugs cleanup of v5 but if I recall correctly it wasn't a trivial fix. The tables implementation was contributed by mcaruso85 and probably needs a refactor to support cases like this one.