Skip to content

Parsing string into json doesn't preserve the order correctly. #1817

@Alppuccino

Description

@Alppuccino
  • Describe what you want to achieve.
    I want to parse a json file from the web, downloaded into a string using libcurl, back into a json object.

  • Describe what you tried.
    Image of code
    This is what I've tried - the former cout prints the string that curl downloaded, which is in the correct order of the original json on the webserver. The second cout simply posts the same json but as a json object, which has been parsed by nlohmann::json. As you can see, it is completely jumbled up. When trying to access a nested part of the json, for example ["teams"]["players"] it returns null and crashes with error 305, cannot use operator[] with a string argument. If you need any more information please don't hesitate to reply.

  • Describe which system (OS, compiler) you are using.
    VS2015 (v140) on Windows 10

  • Describe which version of the library you are using (release version, develop branch).
    release

Metadata

Metadata

Assignees

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions