std.data.json formal review

Sönke Ludwig via Digitalmars-d digitalmars-d at puremagic.com
Wed Jul 29 03:22:39 PDT 2015


Am 29.07.2015 um 12:10 schrieb Jacob Carlborg:
> On 2015-07-29 06:57, Walter Bright wrote:
>
>> A JSON value is a tagged union of the various types.
>
> But in most cases I think there will be one root node, of type object.
> In that case it would be range with only one element? How does that help?
>

I think a better approach that to add such a special case is to add a 
readValue function that takes a range of parser nodes and reads into a 
single JSONValue. That way one can use the pull parser to jump between 
array or object entries and then extract individual values, or maybe 
even use nodes.map!readValue to get a range of values...


More information about the Digitalmars-d mailing list