Parse json into specified descendant class
Is it possible to parse json into specified descendant class?
std::string json = "{ \"name\" : \"Franky\" }"
class Person : Poco::JSON::Object {
// ...
}
Person p = ???(json);
I've seen handlers but didn't find any explicit way to override JSON::Object creation
You "override" JSON::Object creation by implementing your PersonHandler::asVar() to return a Dynamic::Var which can be converted to Person.
As things stand now, it is doable, but not in an optimal way because ParseHandler::setValue() is private and so the whole handler should be reimplemented. We'll make it protected for 1.13
This issue is stale because it has been open for 365 days with no activity.
This issue was closed because it has been inactive for 60 days since being marked as stale.