-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
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
push_back doesn't work for serializing containers #3027
Comments
That works just fine, except for the |
The |
Actually it doesnt work. The only way I could get this to work is to create a container for the containers like so:
then the to_json, and from_json .. Also, according to documentation erase should work too.
|
I am using this for storing redis entries, so it reads and writes to/from json strings. I would like a way to read the string into a json object and push_back or erase without having to parse it back into the struct object first. |
Did you look at the link I included? That shows it compiling. Is there something in your code that you didn't include in your sample that makes it not work?
That's for an object, this is an array.
The
|
Yes, I want push_back for objects. Sorry I guess I didn't explain myself very well.
|
That's not a valid json. You can't have an object as top level inside an object like that. You can have an array of objects:
You can have just an object:
Or you can have a nested object:
The formats of
For normal |
Is there anything to be done here? |
This is probably more of a feature request than a bug, but would be really great if it could behave like an arbitrary container.
error: no matching function for call to ‘nlohmann::basic_json<>::push_back(foobar&)’
The text was updated successfully, but these errors were encountered: