Gson
By default, Gson omits null fields from the output. If you need nulls to appear as "field": null , use the serializeNulls() method in GsonBuilder . 4. Pretty Printing
: Effortlessly convert a Java object into a JSON string using the toJson() method. By default, Gson omits null fields from the output
typically offers higher performance and more extensive features for enterprise-grade web services. only marked fields are processed.
: When combined with excludeFieldsWithoutExposeAnnotation() , only marked fields are processed. By default, Gson omits null fields from the output