Is there a way to get the name of the first property of a JSON object?
I\'d like to do something like this:
var firstProp = jsonObj[0];
When using jQuery, you can also use $.each to iterate over a JSON object. Looks cleaner IMO than using a for-loop
$.each
for
var items = { 'item1': 'content', 'item2': 'content', 'item3': 'content' } $.each(items, function() { console.log($(this)[0]) })