java 对象转json字符串忽略类型,所有值都加上双引号,如何做?我用的是fastjson。
巴扎黑
巴扎黑 2017-04-18 10:30:05
0
2
907
  1. 例如
    我一个对象转成json后是这样

[{"desc":"data","type":1,"name":"data"}]
我想转成这样
[{"desc":"data","type":"1","name":"data"}]
type是int类型

巴扎黑
巴扎黑

reply all(2)
PHPzhong

The standard data format of JSON is that numeric types do not require double quotes, unless your data type is a string. .

PHPzhong
JSON.toJSONString(json, SerializerFeature.WriteNonStringValueAsString)
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!