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

how to serialize class Object (convert data in object into json)?? #1011

Closed
Mamlesh opened this issue Mar 13, 2018 · 5 comments
Closed

how to serialize class Object (convert data in object into json)?? #1011

Mamlesh opened this issue Mar 13, 2018 · 5 comments
Labels
kind: question state: needs more info the author of the issue needs to provide more details

Comments

@Mamlesh
Copy link

Mamlesh commented Mar 13, 2018

No description provided.

@nlohmann nlohmann added the state: needs more info the author of the issue needs to provide more details label Mar 13, 2018
@nlohmann
Copy link
Owner

Without more information, we cannot help you. This may be interesting though: https://github.com/nlohmann/json#arbitrary-types-conversions

@Mamlesh
Copy link
Author

Mamlesh commented Mar 13, 2018

thanks ...but i want to do something like...
//example
class A
{
string a;
}
class B
{
A z;
string n;
}

class Main
{
B b;
}

//data will come in object at run time
// so i want to covert data into direct json string...in c++

@nlohmann
Copy link
Owner

This can be achieved with the conversions described in the link above. You need to define a conversion function to_json for each class.

@Mamlesh
Copy link
Author

Mamlesh commented Mar 13, 2018

Ok i'll try it ..thank you..sir

@nlohmann
Copy link
Owner

@Mamlesh Did it work? Do you need further assistance?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: question state: needs more info the author of the issue needs to provide more details
Projects
None yet
Development

No branches or pull requests

2 participants