You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've visited previous issues mentioning tuple/user-defined types/etc and I thought it would be awesome if I could do something like this: json myJSON; myJSON["stringKey"] = "stringVal"; myJSON["intKey"] = 5; myJSON["customKey"] = myCustomObj; //this is not really needed for my use case auto myTuple = myJSON.get<tuple<string, int, MyType /* again, not super necessary */>();
I'm not 100% sure this is the right way about it, but I think my objective is clear: have a way to store/retrieve (serialize/deserialize) a dictionary/map with custom types and then get those types back automagically.
The text was updated successfully, but these errors were encountered:
The problem is that a tuple is ordered whereas a JSON object is not. Hence, a mapping between the values stored in the JSON object and the types in the tuple is arbitrary.
I've visited previous issues mentioning tuple/user-defined types/etc and I thought it would be awesome if I could do something like this:
json myJSON;
myJSON["stringKey"] = "stringVal";
myJSON["intKey"] = 5;
myJSON["customKey"] = myCustomObj; //this is not really needed for my use case
auto myTuple = myJSON.get<tuple<string, int, MyType /* again, not super necessary */>();
I'm not 100% sure this is the right way about it, but I think my objective is clear: have a way to store/retrieve (serialize/deserialize) a dictionary/map with custom types and then get those types back automagically.
The text was updated successfully, but these errors were encountered: