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

Is there support for automatic serialization/deserialization? #1696

Closed
BigDaddyDeezel opened this issue Aug 1, 2019 · 2 comments
Closed
Labels
kind: question solution: wontfix the issue will not be fixed (either it is impossible or deemed out of scope)

Comments

@BigDaddyDeezel
Copy link

Is there any support for automatic serialization/deserialization? For example some sort of template magic that would just choose a string to use for the key name based on the property name directly, to skip the having to manually add an entry for each property by hand in the from_json() and to_json() methods? I see 2 really helpful benefits there - 1) the obvious of course is less code needing to be written by the developers using this lib, but the more important is 2) if a property is added later to a structure, it wouldn't be accidentally forgotten to be serialized too

@nickaein
Copy link
Contributor

nickaein commented Aug 2, 2019

Short answer: It's not currently possible.

Long answer: Such functionality needs Reflection support in C++ language which is not present yet. There are some discussions and proposals to add support for static reflection in C++ which is targeted for C++23 or later.

@nlohmann nlohmann added the solution: wontfix the issue will not be fixed (either it is impossible or deemed out of scope) label Aug 3, 2019
@nlohmann nlohmann closed this as completed Aug 3, 2019
@lawmaestro
Copy link

Short answer: It's not currently possible.

Long answer: Such functionality needs Reflection support in C++ language which is not present yet. There are some discussions and proposals to add support for static reflection in C++ which is targeted for C++23 or later.

This library provides struct reflection, perhaps this could be a route to achieving this?
https://github.com/cbeck88/visit_struct

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: question solution: wontfix the issue will not be fixed (either it is impossible or deemed out of scope)
Projects
None yet
Development

No branches or pull requests

4 participants