zoukankan      html  css  js  c++  java
  • springboot公共接口接收json数据

    @RestController
    @RequestMapping
    public class TestController {
    
    
        @PostMapping("postArray/{category}/{path}")
        public String postArray(@PathVariable String category,
                                @PathVariable String path,
                                @RequestBody JSONArray jsonArray) {
            System.out.println("postArray/" +category+"/"+ path);
            int size = jsonArray.size();
            for (int i = 0; i < size; i++) {
                JSONObject jsonObject = jsonArray.getJSONObject(i);
                postObject(category,path, jsonObject);
            }
            return path + " ok";
        }
    
        @PostMapping("postObject/{category}/{path}")
        public String postObject(@PathVariable String category,
                                 @PathVariable String path,
                                 @RequestBody JSONObject jsonObject) {
            System.out.println("postObject/" +category+"/"+ path);
            System.out.println(jsonObject);
            return path + " ok";
        }
    }
  • 相关阅读:
    十二月31日
    十二月31号
    10,28
    10,27
    十月26
    十月22
    十月21
    十月二十
    十月16
    0227 数据库的知识
  • 原文地址:https://www.cnblogs.com/wangbin2188/p/15241777.html
Copyright © 2011-2022 走看看