<script type="text/javascript"> getJson('age'); function getJson(key){ var jsonObj={"name":"傅红雪","age":"24","profession":"刺客"}; //1.使用eval方法 var eValue=eval('jsonObj.'+key); alert
// var responseData = response.data.result; for (var r in responseData) { if (responseData[r]["visible"] == 0) { responseData[r]["visible"] = "是"; } else {
获取json对象的长度跟获取一个普通对象或数组的方法不一样,json对象没有length属性,不能直接用.length直接获得. function getJsonLength(json){ var jsonLength = 0; for(var i in json){ jsonLength++; } return jsonLength; }