std.data.json formal review

Steven Schveighoffer via Digitalmars-d digitalmars-d at puremagic.com
Fri Aug 14 06:10:56 PDT 2015


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.

-Steve


More information about the Digitalmars-d mailing list