数据:
oJSONCode1 = [ {"城市":"北京","面积":16800,"人口":1600}, {"城市":"上海","面积":6400,"人口":1800} ] oJSONCode2 = [ ["北京",16800,1600], ["上海",6400,1800] ] oJSONCode3 = { "classA":[ {"name":"张三","nationality":"汉族","nativeplace":"长春"}, {"name":"李四","nationality":"回族","nativeplace":"大连"}, {"name":"王五","nationality":"汉族","nativeplace":"哈尔滨"} ], "classB":[ {"name":"李伟民","nationality":"汉族","nativeplace":"沈阳"}, {"name":"张群","nationality":"汉族","nativeplace":"济南"}, {"name":"王晓芳","nationality":"回族","nativeplace":"西宁"}, {"name":"牟玉兰","nationality":"汉族","nativeplace":"西宁"} ], "classC":[ {"name":"伍晓光","nationality":"汉族","nativeplace":"北京"}, {"name":"杨帆","nationality":"汉族","nativeplace":"广州"} ] }
功能:数组和对象形式JSON数据浏览、修改、添加和删除练习
1、JSON数据(oJSONCode1、oJSONCode2)访问和输出(运行)
2、JSON数据(oJSONCode1、oJSONCode2)添加、修改(运行)
3、JSON数据(oJSONCode1)删除(运行)
4、JSON数据(oJSONCode3)访问和输出(运行)
5、JSON数据(oJSONCode3)添加、修改(运行)
6、JSON数据(oJSONCode3)删除(最后运行)(运行)
效果: