Value method when the json key is a number

  • 2020-03-29 23:46:11
  • OfStack

How to value json when the key of json is a number, such as:
Var aa = {' 111 ':' aaaaa '};
Alert (SSS. 111);
No, alert doesn't play anything.

The json key must be an object to fetch something, such as:
Var aa = {' s111s: "aaaaa"};
Var idd = "s111s";
Alert (SSS. Idd);


Answer:

For numeric key names or unusual variable characters (such as Spaces), you must use aa[x].
Var aa = {' 111 ':' aaaaa '};
Alert (SSS (" 111 "));


Related articles: