主要的json处理的包有 阿里开源的fastjson以及谷歌的gson,其它的有jackson等

其都支持 json对象与javaBean对象间的转换(javaBean对象通常指json的字符串)

 

fastjson中通过postman发送json数据,Controller层进行接收。Controller层的代码如下:

@RestController
@RequestMapping("user")
public class getJSONController {
    
    @RequestMapping(value="/send", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
    public String getJSON(@RequestBody JSONObject jsonPram) {
        JSONObject jsonObject = new JSONObject();
        System.out.println(jsonPram.toString());
//      跳转到相应的jsp页面
        return jsonPram.toJSONString();
    }
}

 json对象,json字符串,json的map间可以相互进行转换,其具体的转换代码如下:

https://www.cnblogs.com/heqiyoujing/p/9840424.html

相关文章:

  • 2022-12-23
  • 2021-10-29
  • 2021-10-24
  • 2022-01-08
  • 2021-10-02
  • 2021-05-26
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-12-30
  • 2021-08-26
  • 2021-04-17
  • 2023-01-29
  • 2022-12-23
相关资源
相似解决方案