//原代码
 JSONObject powerCurveJsonObj = new JSONObject();

  powerCurveJsonObj.put("test",[0.5, 1.0, 1.5]); //后面是 List<Double>

这种方法存储的 List<Double>会变成一个string类型,返回的时候会再Double列表上面加引号"[0.5, 1.0, 1.5]"


解决办法:

将JSONObject中需要存储的数据存放到Map中

Map<String, Object> map = new HashMap<>();

map.put("test",[0.5, 1.0, 1.5]);

JSONObject powerCurveJsonObj = new JSONObject(map);


将map转化为JSONObject类型就可以解决此类问题

  

相关文章:

  • 2021-11-18
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-02-23
  • 2021-08-17
  • 2021-05-23
猜你喜欢
  • 2022-01-08
  • 2022-12-23
  • 2022-01-25
  • 2022-12-23
  • 2022-02-25
  • 2022-01-13
  • 2021-05-22
相关资源
相似解决方案