SpringMVC学习篇(三):响应json格式了解

前提:由于jsp基础薄弱,很多功能实现起来困难,考虑能不能直接以json形式返回的response来设计接口。


响应成功的例子

{
  "success": true,
  "payload": {
    /* Application-specific data would go here. */
  }
}

响应失败的例子

{
  "success": false,
  "payload": {
    /* Application-specific data would go here. */
  },
  "error": {
    "code": 123,
    "message": "An error occurred!"
  }
}

猜你喜欢

转载自blog.csdn.net/LittleGirl_orBoy/article/details/107384533