BERARM BERARM - 4 months ago 19x
JSON Question

How to get json key on nodejs

var temp = '{"name":"abc","0_1":"padforn"}';

The 'temp' variable has two keys.
Please How to get the value use key '0_1' ?


You can access it with JSON.parse(temp)['0_1'] as Rohit says. Note that in order to use dot notation, the identifier cannot start with a number.

Property Accesors

In this code, property must be a valid JavaScript identifier, i.e. a sequence of alphanumerical characters, also including the underscore ("_") and dollar sign ("$"), that cannot start with a number. For example, object.$1 is valid, while object.1 is not.