Is it true that punctuation in property keys can cause developer usability issues in languages such as Ruby which uses symbolic hash key and in Javascript, these characters prevent developers from using dot-notation for property access.
Is it true that punctuation in property keys can cause developer usability issues in
Share
The JSON Specification doesn’t explicitly forbid using hyphens or any other characters in the name/value pairs of objects.
Whether it’s a great idea is another, but most languages have no trouble dealing with special characters as the key, e.g. JavaScript:
Because
a-bis not a valid property namex.a-bwould not work as expected, but JavaScript has an alternative syntax for object dereferencing by using[]notation.Another example, PHP:
Again,
$x->a-bwould not work, so PHP supports dereferencing using->{}notation.