代码如下:
//theOb(json数据)
function print_r(theObj) {
var retStr = '';
if (typeof theObj == 'object') {
retStr += '
';
for (var p in theObj) {
if (typeof theObj[p] == 'object') {
retStr += '
retStr += '
} else {
retStr += '
}
}
retStr += '
'; for (var p in theObj) {
if (typeof theObj[p] == 'object') {
retStr += '
['+p+'] => ' + typeof(theObj) + '
'; retStr += '
' + print_r(theObj[p]) + '
'; } else {
retStr += '
['+p+'] => ' + theObj[p] + '
'; }
}
retStr += '
}
return retStr;
}