Class GsonBuilderUtils
java.lang.Object
org.springframework.http.converter.json.GsonBuilderUtils
A simple utility class for obtaining a Google Gson 2.x
GsonBuilder
which Base64-encodes byte[] properties when reading and writing JSON.- Since:
- 4.1
- Author:
- Juergen Hoeller, Roy Clarkson
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic com.google.gson.GsonBuilderObtain aGsonBuilderwhich Base64-encodesbyte[]properties when reading and writing JSON.
-
Constructor Details
-
GsonBuilderUtils
public GsonBuilderUtils()
-
-
Method Details
-
gsonBuilderWithBase64EncodedByteArrays
public static com.google.gson.GsonBuilder gsonBuilderWithBase64EncodedByteArrays()Obtain aGsonBuilderwhich Base64-encodesbyte[]properties when reading and writing JSON.A custom
TypeAdapterwill be registered viaGsonBuilder.registerTypeHierarchyAdapter(Class, Object)which serializes abyte[]property to and from a Base64-encoded String instead of a JSON array.
-