Skip to content
This repository has been archived by the owner on Sep 24, 2022. It is now read-only.

Serializing Nested Array of Tables incorrectly #180

Closed
alanhdu opened this issue May 30, 2017 · 1 comment · Fixed by #184
Closed

Serializing Nested Array of Tables incorrectly #180

alanhdu opened this issue May 30, 2017 · 1 comment · Fixed by #184

Comments

@alanhdu
Copy link
Contributor

alanhdu commented May 30, 2017

The TOML table equivalent to the following JSON:

{"table": [
  {"inner": [ {} ] }
]}

should serialize into

[[table]]
  [[table.inner]]

Instead, it serializes into:

[[table.inner]]

which is equivalent to {'table': {'inner': [{}]}}.

Found with rust-fuzz/targets#72.

@alanhdu
Copy link
Contributor Author

alanhdu commented May 30, 2017

One result of this is that

extern crate toml;

fn main() {
    let s = r#"
    [[table]]
      [[table.inner]]
    "#;
    let data: toml::Value = toml::from_str(s).unwrap();

    println!("{}", toml::to_string(&data).unwrap());
}

outputs

[[table.inner]]

@alanhdu alanhdu changed the title Serializing Nested Array of Tables into Serializing Nested Array of Tables incorrectly May 30, 2017
alanhdu added a commit to alanhdu/toml-rs that referenced this issue Jun 1, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant