I would like to do:
(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
So far, I tried to:
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);
And there are many date object, please help..
YOu can do this with bundled JSON lib. To get this struct:
(Object)Date:
(Object)HomeTeam:
(Array)Name
(Array)Num
you do JSONObject date = new JSONObject();
JSONObject team = new JSONObject();
team.put("Name", new JSONArray());
team.put("Name", new JSONArray());
date.put("id", team);
Not that "id"
should rather be different per node, or you should switch to JSONArray there.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.