Converting JSON to array key - value in javascript -
i've been developing web application i'm receiving data in format, node server:
"{""elements":[{"10sr2b2":{"total":0,"bad":22,"clients":["fc8e7f","fc8e7e"],"zone":"101900"}}]}"
the poblem data array key-value called "elements" "10sr2b2" key of first element of array.
so when call $.parsejson() method, return object this:
elements: array[1] 0: object 10sr2b2: object zone: "101900" clients: array[2] 0: "fc8e7f" 1: "fc8e7e" length: 2 __proto__: array[0] bad: 22 total: 0
where "10sr2b2" it's supposed key , it's object , need value somehow.
can me?
you use object.keys
object keys.
var keys = object.keys(data.elements[0]);
Comments
Post a Comment