【发布时间】:2022-01-22 21:26:49
【问题描述】:
我有以下java 代码,我试图从JSONArray 对象中提取一组整数。我该怎么做?
JSONObject actionDetail = new JSONObject("myJsonOject");
int personId = actionDetail.getInt("personId");
JSONArray addressIds = actionDetail.getJSONArray("addressIds");
Action action = new Action();
action.setPersonId(personId); //working ok
action.setAddressIds(): //todo - how to get list of ints from the JsonArray?
注意addressIds字段的类型是:Set<Integer>
【问题讨论】: