std.data.json formal review
via Digitalmars-d
digitalmars-d at puremagic.com
Fri Aug 14 06:37:19 PDT 2015
On Friday, 14 August 2015 at 13:30:44 UTC, Andrei Alexandrescu
wrote:
> 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
No, he is wrong, and even if he was right, he would still be
wrong. JSON objects are unordered so if you read then write you
can get:
{
"comment" : "this is the second value",
"value1" : 42,
"value2" : 101
}
More information about the Digitalmars-d
mailing list