var str = '{"dpxid":"DP_144226","count":"5","timevalue":[{"time":"1464273902796","value":"27.0"},{"time":"1464273904796","value":"28.0"},{"time":"1464273906796","value":"27.0"},{"time":"1464273908796","value":"26.0"},{"time":"1464274144796","value":"20.0"}],"error":"OK" }'
console.log("JSON length: " + str.length)
var obj = JSON.parse(str)
console.log("count is: " + obj.count)
字符串的长度
json拥有的属性个数
字符串长度可以通过 str.length 来获得
json拥有的属性个数,可以通过JSON.parse(str)获得js对象,然后循环遍历;