sadek sadek - 3 years ago 158
Javascript Question

Is it possible to use a string with multiple words as json key?

it's common to have json keys without spaces.
I can access a value of a json simply calling it's key. But if my json looks like

"kemon acho": "I am fine"

How can I print
I am fine
Thank you.

Answer Source

You just do:

var j = { "kemon acho": "I am fine" };
console.log(j["kemon acho"]);

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