What would a date type look like? An ISO-8601 string is probably as good as it'll get, else you end up with an object containing loads of additional information like timezones, offsets, etc. There's also https://json-schema.org/understanding-json-schema/reference/... for a formalized date format in JSON.
The looseness seems to be aimed at human authors who want to write JSON as if it were JS, so mainly package.json. But, json is not ideal for configuration for multiple reasons.
If you wanted JSON to parse into actual date objects, you could always do:
{
thisIsADate: new Date('1995-12-17T03:24:00Z')
}
It would be simple enough for parsers in other languages to parse this into their own date objects. Much simpler than using regexs to find ISO strings.
Useful when you need to input already double-quoted value.
But it's a matter of taste still and nothing that we couldn't do before. Such changes will lead to meetings where programmers discuss JSON5 quoting choices (yes, it will be a thing).
It brings it closer to JavaScript behavior I guess.
I guess it's nice to have ability to copy random js object declaration to actual json without editing
Cthulhu_|4 years ago
The looseness seems to be aimed at human authors who want to write JSON as if it were JS, so mainly package.json. But, json is not ideal for configuration for multiple reasons.
rbut|4 years ago
pawelduda|4 years ago
But it's a matter of taste still and nothing that we couldn't do before. Such changes will lead to meetings where programmers discuss JSON5 quoting choices (yes, it will be a thing).
AlfeG|4 years ago
alpaca128|4 years ago
rbut|4 years ago
peoplefromibiza|4 years ago
is this any better?
in many languages single quotes are used as apostrophes and are very very common, much more common than double quotes.eptcyka|4 years ago
The_Colonel|4 years ago