javascript - list only all keys including nested from json object in jquery -


i want list keys(including nested) in json object in jquery... keys/ json object dynamic program never format json sure

i need jquery list keys json

following sample data:

{   "status_code": 200,   "status_text": "success",   "count": 6,   "data": [{     "date": "2012-02-27",     "zone": "north zone",     "centre": "chandigarh",     "commodity": "tea loose",     "price": "265"   }, {     "date": "2012-02-24",     "zone": "north zone",     "centre": "chandigarh",     "commodity": "tea loose",     "price": "265"   }] } 

from above json want list keys.

var jsonarray={ "status_code": 200, "status_text": "success", "count": 6, "data": [ { "date": "2012-02-27", "zone": "north zone", "centre": "chandigarh", "commodity": "tea loose", "price": "265" }, { "date": "2012-02-24", "zone": "north zone", "centre": "chandigarh", "commodity": "tea loose", "price": "265" } ] }  var l = jsonarray.length; (var = 0; < l; i++) { var obj = jsonarray[i]; (var j in obj) {     alert(j); } } 

try works .

demo


Comments

Popular posts from this blog

javascript - Karma not able to start PhantomJS on Windows - Error: spawn UNKNOWN -

c# - Display ASPX Popup control in RowDeleteing Event (ASPX Gridview) -

Nuget pack csproj using nuspec -