Posting a File and Associated Data to a RESTful WebService preferably as JSON

后端 未结 11 839
没有蜡笔的小新
没有蜡笔的小新 2020-11-22 10:45

This is probably going to be a stupid question but I\'m having one of those nights. In an application I am developing RESTful API and we want the client to send data as JSON

11条回答
  •  孤街浪徒
    2020-11-22 11:29

    @RequestMapping(value = "/uploadImageJson", method = RequestMethod.POST)
        public @ResponseBody Object jsongStrImage(@RequestParam(value="image") MultipartFile image, @RequestParam String jsonStr) {
    -- use  com.fasterxml.jackson.databind.ObjectMapper convert Json String to Object
    }
    

提交回复
热议问题