std.data.json formal review

Andrei Alexandrescu via Digitalmars-d digitalmars-d at puremagic.com
Fri Aug 14 06:30:44 PDT 2015


On 8/14/15 9:10 AM, 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:
>
> {
>     "comment" : "this is the first value",
>     "value1" : 42,
>     "comment" : "this is the second value",
>     "value2" : 101
> }
>
> Though, I would much rather see a better comment tag than "comment":.
> json isn't ideal for this.

You're right. Good convo: 
http://stackoverflow.com/questions/21832701/does-json-syntax-allow-duplicate-keys-in-an-object 
-- Andrei



More information about the Digitalmars-d mailing list