Fastjson ToObject transform null to empty string

1.1k views Asked by At

I use FastJSON to deserialize a json into an object. During the deserialization I would like to automatically replace all the null values in the json by an empty string. Is there a JSON parameter to do that? Otherwise, what would you suggest?

1

There are 1 answers

0
Zhu Ran On

You can use JSON.parseObject(String json, Class<T> clazz, Feature... features) method and pass through Feature.InitStringFieldAsEmpty as last argument.