I have this json array:
//val
0: {name: "jeg", class: "klase-jeg", id: "id-jeg"} 1: {age: 11, id: "jeg-id-11"} 2: {mail: "jeg mail", class: "jeg-klas-mail"}
and i want to get the first key of each json:
(name,age,mail)
This is my function:
$.map(val, Object.keys) //Result: ["name", "class", "id", "age", "id", "mail", "class"]
But the result is all the keys.
to get the first key from a json i used this:
obj = val[0]; Object.keys(obj)[0]); //Result: name
and i tried to use it with map but it didnt work :(
$.map(val, Object.keys[0]) //failed
i can use each or for, but i would like to know if can i use map with object.key to get the first key of each json.
Thanks!