关于json update的问题,希望能得到解答
场景再现:
已知文档a.txt内容如下:
{"list": [{"address": "http://www.baidu.com", "img": "http://www.baidu.com/logo.jpg", "title": "百度"}, {"address": "http://www.google.com", "img": "http://www.google.com/logo.jpg", "title": "谷歌"}, {"address": "http://www.yahoo.com", "img": "http://www.yahoo.com/logo.jpg", "title": "雅虎"}]}
b.txt内容如下
{"address": "http://www.sina.com", "img": "http://www.sina.com/logo.jpg", "title": "新浪"}
{"address": "http://www.qq.com", "img": "http://www.qq.com/logo.jpg", "title": "腾讯"}
请问如何通过json.update的命令把b.txt的内容添加到a.txt里面
json.update
? 方法update
表示替换,而不是添加或追加 !