Skip to content

invalid output for 2-dimensional array of table #53

@momentarylapse

Description

@momentarylapse

Hi, I'm getting some weird output when trying to write 2-dimensional arrays with objects/tables inside. I'm trying to save the equivalent of JSON {"A": [ [ {"value": 1} ] ] }.

My code:

toml::Value base;
toml::Array outer;
toml::Array inner;
toml::Value object;
object["value"] = 1;
inner.push_back(object);
outer.push_back(inner);
base["A"] = outer;

base.write(&std::cout);

The code produces:

A = [[value = 1
]]

and toml::parse() flags this as invalid.

Could the curly braces be missing for a correct inline table? I.e.

A = [[{value = 1}]]

Or is there something I should do differently in the code?

Thanks,
Michael

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions