Java获取post请求json格式参数(raw)

  • Post author:
  • Post category:java

在这里插入图片描述

//this.getRequest()此处需要先获取HttpServletRequest对象拿到输入流
BufferedReader br = new BufferedReader(new InputStreamReader(this.getRequest().getInputStream(), "UTF-8"));
String line = null;
StringBuilder sb = new StringBuilder();
while ((line = br.readLine()) != null) {
    sb.append(line);
}
br.close();
JSONObject jsonObject = JSONObject.fromObject(sb.toString());

版权声明:本文为qq_40977118原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。