@Override public InputStream getStream() throws IOException { ByteArrayOutputStream out = new ByteArrayOutputStream(1024); OutputStreamWriter streamWriter = new OutputStreamWriter(out, "UTF-8"); PrintWriter writer = new PrintWriter(streamWriter); // jsonObject.print(writer); jsonObject.prettyPrint(writer); writer.close(); out.close(); return new ByteArrayInputStream(out.toByteArray()); }