Boost logo

Boost Users :

Subject: [Boost-users] [property_tree] Serializing ptree to/from JSON
From: Michael Powell (mwpowellhtx_at_[hidden])
Date: 2013-06-21 16:20:30


Hello,

I am writing some code to serialize a package to/from JSON. Overall,
it is working well, except for what appears to be a weak link in the
ptree chain of events.

I take a POCO (for all intents) and populate a ptree, then parse that
to JSON using the property_tree JSON parser. No problem.

Then I take that same string and want to parse it into another ptree.
In and of itself, seems like it is no problem. The new ptree has a
count, so I gather the parse worked.

However, when I try to use ptree.count(path), or ptree.find(path),
neither of these work. They are returning 0 or not_found(),
respectively.

I may be able to bypass that check for the moment and run it through
ptree.get<Type>(path) for the time being, but that seems less
desirable.

Any insights on ptree along these lines?

Thanks!

Regards,

Michael Powell


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net