Subject: Re: [boost] [gsoc] JSON?
From: Sebastian Redl (sebastian.redl_at_[hidden])
Date: 2011-04-05 04:45:39


On 05.04.2011 07:11, Rene Rivera wrote:
> On 4/4/2011 1:15 AM, James Mansion wrote:
>> Rene Rivera wrote:
>>> Students and other interested parties,
>>>
>>> I would love it if there was a Boost quality JSON data parser, and
>>> optional printer, library.
>> What about improving the one in PropertyTree?
>
> Property Tree is not capable of faithfully representing the data that
> can be stored in a JSON file.
To be more precise, a ptree or wptree is not capable of doing this. A
basic_ptree instantiated with JSON-specific data and key types would be
(though it would then be a superset of what JSON can do).

> * One can't discern, as a user, between vectors/arrays and maps/objects.
If you're confident that your tree structure is JSON-compatible, it's
pretty easy to distinguish. But there's no way to force the tree to be
JSON-compatible.
>
> * It can't use key names with "." in the name.
Yes it can. Though the parser might need to be audited to make sure it
handles them correctly.
>
> And one discrepancy which could be addressed:
>
> * It reinterprets some string data as non-string data (I'm referring
> to the strings "true" & "false" being interpreted as the values true &
> false).
Loss of type information is the biggest problem that the current PTree
JSON support has.

Sebastian