Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nested objects serialize/deserialize #1941

Closed
SadE54 opened this issue Feb 12, 2020 · 1 comment
Closed

Nested objects serialize/deserialize #1941

SadE54 opened this issue Feb 12, 2020 · 1 comment
Labels
kind: question solution: proposed fix a fix for the issue has been proposed and waits for confirmation

Comments

@SadE54
Copy link

SadE54 commented Feb 12, 2020

Hi ,

I have to write a config file from a node editor with something like this

struct Node
{
int id;
string name;
}

struct Pin
{
int id;
Node* node;
}

struct Link
{
int id;
Pin* start;
Pin* end;
}

struct Config
{
std::vector Nodes;
std::vector Pins;
std::vector Links;
}

How can i serialize the topover object Config ? and deserialize ?
Thanks!

@nickaein
Copy link
Contributor

You just have to provide from_json and to_json functions for each type as mentioned in README.

Also relevant: #1648

@nlohmann nlohmann added the solution: proposed fix a fix for the issue has been proposed and waits for confirmation label Feb 14, 2020
@SadE54 SadE54 closed this as completed Feb 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: question solution: proposed fix a fix for the issue has been proposed and waits for confirmation
Projects
None yet
Development

No branches or pull requests

3 participants