@Override protected Object readInternal(Class clazz, HttpInputMessage inputMessage) throws IOException, HttpMessageNotReadableException { try(InputStream is = inputMessage.getBody()) { if(clazz.isArray()) { try(InputStreamReader reader = new InputStreamReader(is, getCharset(inputMessage))) { try { JsonArray a = JSON.parse(reader).asJsonArray(); Object o = Array.newInstance(clazz.getComponentType(), a.length()); for(int i=0;i<a.length();i++) { Object item = Reflection.newInstance(clazz.getComponentType()); ((JsonParsable)item).parseJson(a.getObject(i)); Array.set(o, i, item); } return o; }catch (Exception e) { throw new HttpMessageNotReadableException(e.getMessage(), e); } } }else { Object o = Reflection.newInstance(clazz); try { ((JsonParsable)o).parseJson(IO.readString(is, getCharset(inputMessage))); return o; }catch (Exception e) { throw new HttpMessageNotReadableException(e.getMessage(), e); } } } }