I'am getting jsonobject as [{"id":"[66]"}] how can i convert to jsonarray?
Here is my code:
public Object[] showCampaigns(@RequestParam("selectedAccId") String selectedAccId, HttpSession session, Model model) {
Object[] responseBody = new Object[1];
List<Long> accountIds=new ArrayList<>();
try {
JSONArray clientjson = new JSONArray(selectedAccId);
for (int i = 0; i < clientjson.length(); ++i) {
JSONObject rec = clientjson.getJSONObject(i);
long id = Long.parseLong(rec.getString("id"));
accountIds.add(id);
}
}
Error I'am gettinbg is: Long.parseLong(rec.getString("id")) = >Exception occurred in target VM: For input string: "[66]"<