Closed Shravan40 closed 7 years ago
You're looking for much more magic than you're going to find here. There's no automatic introspection in this library (and I'd doubt whether it's possible to create such a library in C++). You need to build JSON objects with the fields you want, and give them the names you want, etc.
@Shravan40 You may want to have a look at nlohmann/json. It allows to define serialization/deserialization code for arbitrary types, see https://github.com/nlohmann/json#arbitrary-types-conversions.
(Note I am the author of nlohmann/json and I am only posting here, because the issue has not been fixed.)
@nlohmann : Thank you for the information. It seems your's library serves my purpose. I will go through the documentation and try to implement it. In case of queries I will get back to you.
I have a
struct
I would like to convert
vector<studentDetails> sData;
into json object. Alsostd::string studentJson = Json(sData).dump();
is not working.