String transferURL = JSON.parseObject(httpClientResponse.getContent()).getString("transferURL"); ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); QRCodeUtil.writeToStream(transferURL, outputStream, 256, 256); String pngBase64 = new BASE64Encoder().encode(outputStream.toByteArray()) .replaceAll("\\\\r", "") .replaceAll("\\\\n", "") ; return RtMsg.dataOk() .put("base64", "data:image/png;base64,"+ pngBase64);