首页 > 技术文章 > 去除阿里巴巴的JSON-踩雷

xuerong 2020-06-23 17:57 原文

 

 由上图的JSON.toJSON替换成Gsons.toJson  原本以为JSON.toJSON是转换成String。实际上不是

JSON.toJSON (转换成JSONObject对象)和Gsons.toJson (转换成String)

由于该map不应该存string ,于是改造成Map

      document.put("request", Gsons.toMap(Gsons.toJson(serviceRequestDetail.getRequestDetail())));
      document.put("response", Gsons.toMap(Gsons.toJson(serviceRequestDetail.getResponseDetail())));
     

 

推荐阅读