java - Object to Json including only fields not null -
i have object named item plenty of fields. i'm using java json (json-io) library serialize state in file:
string json = jsonwriter.objecttojson(item); // write string file
i'd make json string less verbose not include null values (if possible boolean false). possible somehow ?
thanks
i can recommend using jackson mapper if possible. check out these 2 questions:
jackson serialization: ignore empty values (or null)
how tell jackson ignore field during serialization if value null?
Comments
Post a Comment