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 have difficulties with dumping all data from a json object into a string.
I created a json object with multyple fields and assigned values to them. The data types are std::string, unsigned int, ushort, and pid_t. I can successfully read the data back with a statement: jsonMsg[item_name].get<item_type>();
However, when I want to return the created json object as a std::string object, this fails: std::string strJson = jsonMsg.get<std::string>();
also this: std::string strJson = jsonMsg.dump();
I want to represent the nlohmann::json as bunch of bytes stored in std::string so I could pass it across software modules and at the end just convert these bytes back to nlohmann json object.
I was doing this with the boost property tree. Can I do it with nlohmann json?
Thank you for help.
The text was updated successfully, but these errors were encountered:
I have difficulties with dumping all data from a json object into a string.
I created a json object with multyple fields and assigned values to them. The data types are std::string, unsigned int, ushort, and pid_t. I can successfully read the data back with a statement:
jsonMsg[item_name].get<item_type>();
However, when I want to return the created json object as a std::string object, this fails:
std::string strJson = jsonMsg.get<std::string>();
also this:
std::string strJson = jsonMsg.dump();
I want to represent the nlohmann::json as bunch of bytes stored in std::string so I could pass it across software modules and at the end just convert these bytes back to nlohmann json object.
I was doing this with the boost property tree. Can I do it with nlohmann json?
Thank you for help.
The text was updated successfully, but these errors were encountered: