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转成对象直接拿呗。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)