Moti Mashiah
asked on
Javascript/Json
Hi Guys,
I would like to get the property names from a Javascript object to build a table dynamically. Example:
var data = [{
Name: "xxxx",
Last: "bbbbb"
},
{
Name: "ddddd",
Last: "sssss"
}]
Now imagine this properties (Name , Last) come in different name from the database so how could I retrieve the property data from the json array with javascript.
Thank.
I would like to get the property names from a Javascript object to build a table dynamically. Example:
var data = [{
Name: "xxxx",
Last: "bbbbb"
},
{
Name: "ddddd",
Last: "sssss"
}]
Now imagine this properties (Name , Last) come in different name from the database so how could I retrieve the property data from the json array with javascript.
Thank.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thank you this is exactly what I was looking for:
var keys = Object.keys(data[0]);
var keys = Object.keys(data[0]);
Open in new window