Skip to content

How to deserialize arrays from json #1681

@WhoseTheNerd

Description

@WhoseTheNerd
  • Describe what you want to achieve.
    I want to get std::vectors from json
{
  "vertices": [
    3.227124,
    ...
  ],
  "textureCoords": [
     0.863038,
     ...
  ],
  ...
}
  • Describe what you tried.
    I tried code below, and got confused what j.get() does or works, since there is no wiki on this repo
auto j = json::parse(json);
std::vector<float> positions;
positions = j["vertices"];
  • Describe which system (OS, compiler) you are using.
    Ubuntu 18.04 LTS
$ gcc --version
gcc (Ubuntu 7.4.0-1ubuntu1~18.04.1) 7.4.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  • Describe which version of the library you are using (release version, develop branch).
    develop branch by just putting it into the project.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions