Skip to content

Parsed json data is not in the same order as the original. #68

@kondrak

Description

@kondrak

Thanks for this crate!
I'm currently writing a code generator, where you can define the API using JSON. I noticed that if a list of elements is used, the resulting parsed output is not in the same order as defined in the original JSON data, which is a bit of a problem. Example:

What I pass to JSON parser:

{
  "struct": {
  "var": { "type": "int", "name": "x" },
  "func": [ { "type": "int", "name": "return_int" } ]
  }
}

What I get after parsing and printing the parsed data to screen:

{"struct":{"func":[{"name":"return_int","type":"int"}],"var":{"name":"x","type":"int"}}}

Is there a way to get the output exactly in the same order as I defined? So far I'm iterating over members() and entries() and I can't see any other way to do it properly.

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions