我想这样做:
(Object)Date:
(Object)HomeTeam:
(Array)Name
(Array)Num
(Object)AwayTeam:
(Array)Name
(Array)Num
(Object)Date:
(Object)HomeTeam:
(Array)Name
(Array)Num
(Object)AwayTeam:
(Array)Name
(Array)Num
(Object)Date:
(Object)HomeTeam:
(Array)Name
(Array)Num
(Object)AwayTeam:
(Array)Name
(Array)Num
到目前为止,我试图:
JSONObject json = new JSONObject();
JSONObject home = new JSONObject();
JSONObject away = new JSONObject();
json.put("Date", xxx); I dun know how to do
json.put("HomeTeam", home);
json.put("AwayTeam", away);
并且有许多日期对象,请帮助..
答案 0 :(得分:0)
你可以使用捆绑的JSON lib来做到这一点。要获得此结构:
(Object)Date:
(Object)HomeTeam:
(Array)Name
(Array)Num
你做到了
JSONObject date = new JSONObject();
JSONObject team = new JSONObject();
team.put("Name", new JSONArray());
team.put("Name", new JSONArray());
date.put("id", team);
不是"id"
每个节点应该不同,或者你应该在那里切换到JSONArray。