std.data.json formal review
Walter Bright via Digitalmars-d
digitalmars-d at puremagic.com
Tue Jul 28 22:43:20 PDT 2015
On 7/28/2015 3:55 PM, Walter Bright wrote:
>> OTOH, some people might want the option of parser-driven data processing
>> instead (e.g. the JSON data is very large and we don't want to store the
>> whole thing in memory at once).
>
> That is a good point.
So it appears that JSON can be in one of 3 useful states:
1. a range of characters (rc)
2. a range of nodes (rn)
3. a container of JSON values (values)
What's necessary is simply the ability to convert between these states:
(names are just for illustration)
rn = rc.toNodes();
values = rn.toValues();
rn = values.toNodes();
rc = rn.toChars();
So, if I wanted to simply pretty print a JSON string s:
s.toNodes.toChars();
I.e. it's all composable.
More information about the Digitalmars-d
mailing list