2013/4/12 Michael Marcin
Arindam Mukherjee wrote:
In JSON we typically deal with maps and arrays. The arrays themselves could have arbitrary types (string, object, array, numeric, boolean, null) as elements. The key types in the maps are always strings and the value types in the maps could be anything that can appear in an array, including another map or array.
Due to this, I'd imagine being able to use Boost.Variant or Boost.Any in a list and as a value_type in a map would help.
I have been doing some work with JSON and boost by modifying the current 1.53 ptree. I created a type for use as the data_type of the ptree that represents the various options for JSON data (no value, null value, bool, integer, float, string). It uses boost::variant and visitors. I have it working for my purposes, but would want to make it a little nicer before submitting a patch. I also implemented property_tree::translator_ between to make it work with the spirit classic parser in json_parser_read and json_parser_write. I can post more if anyone is interested. I'm also working a generic way to load arbitrary structures from the created ptree. -John V