From: Jorge on
On May 6, 5:27 am, "Jon Paal [MSMD]" <Jon nospam Paal @ everywhere dot
com> wrote:
> A solution to the original json structure:
>
> success: function(json, status) {
> var records = json.Records;
> var str = "";
> if(records ){
> for(var i = 0; i < records.length; i++){
> for(var j in records[i]){
> str += j + " --> " + records[i][j] + "\n";
> }
> }
> alert(str);
> }

Jon, a couple of things about this :

1.- Note, just in case it matters, that the for(var j in records[i])
loop does not specify the order in which the properties of records[i]
are enumerated : you may end up with both firstname,lastname or
lastname,firstname and there is no way to tell in advance what the
order will be.

2.- It's usually a good idea to query the hasOwnProperty method in
order to screen out (unwanted) inherited properties :

for (var j in records[i]) {
if ( records[i].hasOwnProperty(j) ) {
str += j + " --> " + records[i][j] + "\n";
}
}

--Jorge.