View Full Version : How to get keys out of JSON and build an grid

2 Sep 2011, 8:19 AM
Hi @all
my actual problem is following.
I use an formpanel to submit some data to the server, something like an search function with combos and checkboxes. Server returns me an JSON with results. Depence of the data in the JSON I have to build an grid for this data. The point is that I don`t know how many columns the grid should have.

How can I access the JSON und run through to generate the grid. something like for each where I make every key to an column.
If you have any links which could help me out it would be great.

thx in advance
greets streha

I switch to an other solution. I provide all necsessery data throu the json so the serverside script decides about everything.

8 Nov 2011, 5:39 AM
Do you get any idea about how to get keys from json.Is there any possibilty to get the keys out?



8 Nov 2011, 7:55 AM
You just have to parse the JSON and once you have a native JS object, you use a for in loop.

for (var key in obj) { console.log(key); }