So I am working on an assignment and I need to parser several properties into a json to send over a network. Here is what the final value should look like.
{"__type":"Login:#Messages","Identity":{"sNumber":"value","Alias":"value","FirstName":"value","LastName":"value"}}
so the code I have is
boost::property_tree::ptree pt;
pt.put("__type", "Login:#Messages");
pt.put("Identity", myPlayer.Encode());
myplayer is a class that contains snumber, alias, firstname, lastname. the encode function returns a ptree but when I go to write_json it seems it doesnt know how to handle a ptree in a ptree. I tried parsing myPlayer into a json and puting that in the tree but it gives me this
{"__type":"Login:#Messages","Identity":"{\"sNumber\":\"value\",\"Alias\":\"value\",\"FirstName\":\"value\",\"LastName\":\"value\"}"}
so how to I get boost to parse a ptree such that it can do a ptree in a ptree or doesnt add the escapes for the quotes and doesnt put the Identity property's value as a string? Thanks