javascript get json object key name and value

Encountered a problem is encountered { "1",: "a"}, { "2", "b"} json this object key name is not fixed, and do not know how to take the monitor is below object, there is no property methods. The first touch json, try for yourself with the index [0], [1] are acquired, they failed.

Later find the answer online

= {D '. 1': 'A', '2': 'B'}
for (I in D)
{
   I is the key, d [i] is the value
}

 

Guess you like

Origin www.cnblogs.com/cqLynnLee/p/10962142.html