json文件不是数组形式的,只是多个键值对,怎么解析,求Java实现
不能用jsonarry函数,报错org.json.JSONException:JSONObject["count"]isnotaJSONArray我的数据格式为{"yel...
不能用jsonarry函数,报错org.json.JSONException: JSONObject["count"] is not a JSONArray
我的数据格式为
{"yelping_since": "2012-02", "votes": {"funny": 1, "useful": 5, "cool": 0}, "review_count": 6, "name": "Lee", "user_id": "qtrmBGNqCvupHMHL_bKFgQ", "friends": [], "fans": 0, "average_stars": 3.8300000000000001, "type": "user", "compliments": {}, "elite": []}
{"yelping_since": "2011-12", "votes": {"funny": 0, "useful": 0, "cool": 0}, "review_count": 1, "name": "Matthew", "user_id": "MWhR9LvOdRbqtu1I_DRFBg", "friends": ["8Y2EN4XNNhnwssuPb31sJg", "fdSfg45S-P-FcVF-VIUOew"], "fans": 0, "average_stars": 5.0, "type": "user", "compliments": {}, "elite": []}
我想从json文件中提取user_id、friends键值到txt文件中,怎么弄 展开
我的数据格式为
{"yelping_since": "2012-02", "votes": {"funny": 1, "useful": 5, "cool": 0}, "review_count": 6, "name": "Lee", "user_id": "qtrmBGNqCvupHMHL_bKFgQ", "friends": [], "fans": 0, "average_stars": 3.8300000000000001, "type": "user", "compliments": {}, "elite": []}
{"yelping_since": "2011-12", "votes": {"funny": 0, "useful": 0, "cool": 0}, "review_count": 1, "name": "Matthew", "user_id": "MWhR9LvOdRbqtu1I_DRFBg", "friends": ["8Y2EN4XNNhnwssuPb31sJg", "fdSfg45S-P-FcVF-VIUOew"], "fans": 0, "average_stars": 5.0, "type": "user", "compliments": {}, "elite": []}
我想从json文件中提取user_id、friends键值到txt文件中,怎么弄 展开
2个回答
展开全部
["myarray": 你上面的代码]
注意:在你的两条记录中间用","分割开来。这样你根据myarray取就对了。
注意:在你的两条记录中间用","分割开来。这样你根据myarray取就对了。
追问
能不能把详细代码写一下,我是新手,不太懂,另外这个文档很大,是个数据集,Java读取很慢,怎么才能读取快些,谢谢
追答
json就是一个格式。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询