BERARM BERARM - 1 year ago 96
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' ?

Answer Source

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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download