charmosz
charmosz

Reputation: 133

Fastjson ToObject transform null to empty string

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?

Upvotes: 0

Views: 1393

Answers (1)

Zhu Ran
Zhu Ran

Reputation: 93

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

Upvotes: 1

Related Questions