Simple Solution
  • Java
  • Spring
  • Spring Boot
  • Tutorials
  • Tags
Java Gson versioning support using @Since annotation
Java Gson versioning support using @Since annotation

In this Java Gson tutorial we learn how to @Since annotation to support versioning during serialization or deserialize JSON with Gson library.

Java Gson custom field name using @SerializedName annotation
Java Gson custom field name using @SerializedName annotation

In this Java Gson tutorial we learn how to configure Gson to customize the field name during serialization JSON. Via step by step tutorial we will show you how to use the @SerializedName annotation to override field names.

Java Gson enable Serialize null fields
Java Gson enable Serialize null fields

In this Java Gson tutorial we learn how to configure Gson to enable serializing null fields during serialization JSON. Via step by step tutorial we will show you how to use the GsonBuilder.serializeNulls() method to configure Gson to serialize null fields.

Java Gson exclude fields using ExclusionStrategy interface
Java Gson exclude fields using ExclusionStrategy interface

In this Java Gson tutorial we learn how to exclude fields during serialization or deserialize JSON by using the ExclusionStrategy interface. Via step by step tutorial we will show you how to use the GsonBuilder.setExclusionStrategies() method and com.google.gson.ExclusionStrategy interface to configure Gson to exclude fields based on custom implementation.

Java Gson exclude fields using @Expose annotation
Java Gson exclude fields using @Expose annotation

In this Java Gson tutorial we learn how to exclude fields during serialization or deserialize JSON to exclude fields based on @Expose annotation. Via step by step tutorial we will show you how to use the GsonBuilder.excludeFieldsWithoutExposeAnnotation() method to configure Gson to exclude fields without @Expose annotation.

Java Gson exclude fields with modifiers
Java Gson exclude fields with modifiers

In this tutorial we learn how to configure Gson to exclude fields during serialization or deserialize JSON to exclude fields with specific access modifiers. Via step by step example we will show you how to use the GsonBuilder.excludeFieldsWithModifiers() method to override Gson configuration to exclude fields by given modifiers.

Convert Java Object to JSON File in Java using Gson
Convert Java Object to JSON File in Java using Gson

In this Java Gson tutorial we learn how to use the Gson library to convert a Java object into JSON file using the Gson.toJson() method with FileWriter. Via different Java program examples we show you how to convert a JSON file from an object of HashMap, ArrayList, an object of a custom defined class or a List of objects.

Generate Pretty Print JSON String in Java using Gson
Generate Pretty Print JSON String in Java using Gson

In this Java Gson tutorial we learn how to use the Gson library to generate a readable pretty print JSON String from a Java object. Via Java detail Java example we will show you how to use the GsonBuilder.setPrettyPrinting() method to configure Gson to output JSON String that fits in a page for pretty printing.

Convert Java Object to JSON String in Java using Gson
Convert Java Object to JSON String in Java using Gson

In this Java Gson tutorial we learn how to use the Gson library to convert a Java object to a JSON String using the Gson.toJson() method. Via step by step Java example we show you how to convert to a JSON String from a HashMap, a List of HashMap, a Java object or List of Java objects.

Copyright © 2019 SimpleSolution.dev. All Rights Reserved.