fastjson 使用JSON.toJSONString(Object object)时返回值多了一层双引号

ssgvzors  于 2021-11-27  发布在  Java
关注(0)|答案(1)|浏览(2058)
  • No description provided.*
kxkpmulp

kxkpmulp1#

问题:一个结构为:{"itemId":"SP0000982","notSupportSkuList":{"lease":[]},"operateType":"onShelf","userId":"EMq6NMsNT","userName":"xtt"} 的Object,直接调用.toString()方法时,结果为:"{"itemId":"SP0000982","notSupportSkuList":{"lease":[]},"operateType":"onShelf","userId":"EMq6NMsNT","userName":"xtt"} ",但是调用fastjson的JSON.toJSONString(Object object)时返回值为""{"itemId":"SP0000982","notSupportSkuList":{"lease":[]},"operateType":"onShelf","userId":"EMq6NMsNT","userName":"xtt"} "",额外套了一层双引号,是SerializeWriter的writeStringWithDoubleQuote(String text, final char seperator)方法里buf[]数组开头和结尾添加了引号,这个引号是否可以去掉?

相关问题