11.04.2013 1:46, Stephan Bourgeois пишет:
I am studying for an MSc in Computer Science at Oxford Brookes University. I have taken a compiler construction course this year and I am therefore interested in the JSON Parser idea for the Boost library. There already is a json parser example in http://svn.boost.org/svn/boost/trunk/libs/spirit/example/qi/json/
I think it would be good to move it to the boost::spirit repository and to the release branch. It may be also a good idea to use this parser in the boost::property_tree instead of the current one.
The question is what data structure we should use to represent JSON objects, and how the user can access key/value pairs in those objects. (examples: Boost.PropertyTree, pre-existing C++ object, ...) The structure used in the spirit/example/qi/json/ looks reasonable: the json object is represented as a map
and the value is represented as a boost::variant (with some wrapper around it).
I don't like the boost::property_tree approach because it loses all the type information for the values. -- Best regards, Sergey Cheban