版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_24606505/article/details/78039941
1、
json.forEach((item) => {
for (var key in item) {
if (item[key] instanceof Array) {
console.log(key + "是Array类型,数据为:" + JSON.stringify(item[key]))
} else {
if (typeof (item[key]) == "object") {
console.log(key + "是Object类型,数据为:" + JSON.stringify(item[key]))
}
if (typeof (item[key]) == "number") {
console.log(key + "是Number类型,数据为:" + item[key])
}
}
}
for (var key in item) {
if (item[key] instanceof Array) {
console.log(key + "是Array类型,数据为:" + JSON.stringify(item[key]))
} else {
if (typeof (item[key]) == "object") {
console.log(key + "是Object类型,数据为:" + JSON.stringify(item[key]))
}
if (typeof (item[key]) == "number") {
console.log(key + "是Number类型,数据为:" + item[key])
}
}
}
})
2、例:[{"pagestate":"0"}]
要单独获取pagestate,则:pagestate=data[1]["pagestate"];