Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Feb 10, 2012 08:58 AM by vinay13mar
Contributor
2137 Points
487 Posts
Feb 10, 2012 05:59 AM|LINK
Hi,
I have Array of Object like below in Jquery, i want to get name of the column. Value is not important here.
var obj= data.Shape gives me below line but out of this i need name of the Shape like Round, Princess etc....
Shape: Object { Round=156057, Princess=54292, Marquise=12941, more...}
Please suggest me...
Thanks
All-Star
35547 Points
5696 Posts
Feb 10, 2012 06:40 AM|LINK
if it is javascript object then property name and value should be delimitted by colon - :
then this works
var shapeObject = { Round:156057, Princess:54292, Marquise:12941}; for (var name in shapeObject) { alert(name); }
else u will have to use a string split logic
hope this helps...
30184 Points
4906 Posts
Feb 10, 2012 08:49 AM|LINK
Are you trying to create JSON data to HTML table. If so, check this post-
http://growingtech.blogspot.in/2010/12/json-to-html-table.html
Star
7778 Points
1632 Posts
Feb 10, 2012 08:58 AM|LINK
Please check the links
http://msdn.microsoft.com/en-us/library/bb299886.aspx
http://en.wikipedia.org/wiki/JSON
http://msdn.microsoft.com/en-us/library/system.runtime.serialization.json.jsonreaderwriterfactory.aspx
subhash.shel...
Contributor
2137 Points
487 Posts
Need only names from array of object.
Feb 10, 2012 05:59 AM|LINK
Hi,
I have Array of Object like below in Jquery, i want to get name of the column. Value is not important here.
var obj= data.Shape gives me below line but out of this i need name of the Shape like Round, Princess etc....
Shape: Object { Round=156057, Princess=54292, Marquise=12941, more...}
Please suggest me...
Thanks
Subhash
Please, Mark as Answer if this reply helped you.
kedarrkulkar...
All-Star
35547 Points
5696 Posts
Re: Need only names from array of object.
Feb 10, 2012 06:40 AM|LINK
if it is javascript object then property name and value should be delimitted by colon - :
then this works
var shapeObject = { Round:156057, Princess:54292, Marquise:12941};
for (var name in shapeObject) {
alert(name);
}
else u will have to use a string split logic
hope this helps...
KK
Please mark as Answer if post helps in resolving your issue
My Site
asteranup
All-Star
30184 Points
4906 Posts
Re: Need only names from array of object.
Feb 10, 2012 08:49 AM|LINK
Hi,
Are you trying to create JSON data to HTML table. If so, check this post-
http://growingtech.blogspot.in/2010/12/json-to-html-table.html
Anup Das Gupta
Mark as Answer if you feel so. Visit My Blog
vinay13mar
Star
7778 Points
1632 Posts
Re: Need only names from array of object.
Feb 10, 2012 08:58 AM|LINK
Hi,
Please check the links
http://msdn.microsoft.com/en-us/library/bb299886.aspx
http://en.wikipedia.org/wiki/JSON
http://msdn.microsoft.com/en-us/library/system.runtime.serialization.json.jsonreaderwriterfactory.aspx
V.K.Singh