Why I Can't Access Json Dictionary Element Using Dot Notation?
I have a following JSON representation: var collectionCopy = JSON.parse(JSON.stringify( { 1 : { 2: '2' } } )); Why cant I access key '2' using dot notation (i.e.
Solution 1:
You can use the dot notation for accessing an object's properties only on a valid identifiers in the language.
And since numbers (or anything that starts with a number) are not a valid identifiers you can access it (as a property of an object) only with the bracket notation.
Post a Comment for "Why I Can't Access Json Dictionary Element Using Dot Notation?"