@Put("json") public String update(JsonRepresentation foos) { JSONArray fooArray = foos.getJsonArray(); // ... }
if (JSONArray.class.isAssignableFrom(target)) { try { result = target.cast(jsonSource.getJsonArray()); } catch (JSONException e) { IOException ioe = new IOException(
if (JSONArray.class.isAssignableFrom(target)) { try { result = target.cast(jsonSource.getJsonArray()); } catch (JSONException e) { IOException ioe = new IOException(
@Override public Collection<ResponseEntity> call(final String path, final JSONArray inputJson) throws ServiceException { Collection<ResponseEntity> responses = new ArrayList<>(); Preconditions.checkNotNull(inputJson); ClientResource service = createClient(path); try { Representation result = service.put(new JsonRepresentation(inputJson)); JsonRepresentation jsonRepresentation = new JsonRepresentation(result); if (service.getStatus().equals(Status.SUCCESS_OK)) { JSONArray jsonArray = jsonRepresentation.getJsonArray(); for (int i = 0; i < jsonArray.length(); i++) { ResponseEntity response = JsonUtil.fromJson(jsonArray.getJSONObject(i), ResponseEntity.class); responses.add(response); } } else { JSONObject jsonResult = jsonRepresentation.getJsonObject(); LOGGER.error("Unexpected HTTP status code returned: {}", service.getStatus().getCode()); throwServiceException(jsonResult); } } catch (JSONException | IOException | ResourceException e) { throwServiceException(service, e); } return responses; }
} else JSONArray jsonResult = jsonRepresentation.getJsonArray();
JSONArray jsonArray = jsonRepresentation.getJsonArray(); for (int i = 0; i < jsonArray.length(); i++)