std.data.json formal review

via Digitalmars-d digitalmars-d at puremagic.com
Fri Aug 14 06:15:36 PDT 2015


On Friday, 14 August 2015 at 13:10:53 UTC, Steven Schveighoffer 
wrote:
> On 8/14/15 8:51 AM, Andrei Alexandrescu wrote:
>> On 8/13/15 8:16 PM, Walter Bright wrote:
>>> On 8/13/2015 5:22 AM, CraigDillabaugh wrote:
>>>> No configuration file should be in a format that doesn't 
>>>> support
>>>> comments.
>>>
>>> [ "comment" : "and you thought it couldn't have comments!" ]
>
> This is invalid (though probably unintentionally). An array 
> cannot have names for elements.
>
>> There can't be two comments with the same key though. -- Andrei
>
> Why not? I believe this is valid json:


http://tools.ietf.org/html/rfc7159

«The names within an object SHOULD be unique.»

«An object whose names are all unique is interoperable in the 
sense
    that all software implementations receiving that object will 
agree on
    the name-value mappings.  When the names within an object are 
not
    unique, the behavior of software that receives such an object 
is
    unpredictable.  Many implementations report the last 
name/value pair
    only.  Other implementations report an error or fail to parse 
the
    object, and some implementations report all of the name/value 
pairs,
    including duplicates.

    JSON parsing libraries have been observed to differ as to 
whether or
    not they make the ordering of object members visible to calling
    software.  Implementations whose behavior does not depend on 
member
    ordering will be interoperable in the sense that they will not 
be
    affected by these differences.»



More information about the Digitalmars-d mailing list