- All Superinterfaces:
RuntimeType.Api<JsonBindingConfig>
Main interface for JSON binding operations.
This interface provides methods for serializing Java objects to JSON and deserializing JSON back to Java objects. It supports various input/output formats including strings, streams, readers, writers, and byte arrays.
Serialization methods must accept null as the value to serialize.-
Method Summary
Modifier and TypeMethodDescriptionstatic JsonBindingConfig.Builderbuilder()Return a builder for configuring JsonBinding instances.static JsonBindingcreate()Create a default JsonBinding instance.static JsonBindingcreate(JsonBindingConfig config) Create a JsonBinding instance with the specified configuration.static JsonBindingcreate(Consumer<JsonBindingConfig.Builder> consumer) Create a JsonBinding instance using the provided consumer to configure it.<T> Tdeserialize(byte[] bytes, GenericType<T> type) Deserializes JSON from a byte array to an object of the specified generic type.<T> Tdeserialize(byte[] bytes, Class<T> type) Deserializes JSON from a byte array to an object of the specified type.<T> Tdeserialize(JsonValue jsonValue, GenericType<T> type) Deserializes a JsonValue to an object of the specified generic type.<T> Tdeserialize(JsonValue jsonValue, Class<T> type) Deserializes a JsonValue to an object of the specified type.<T> Tdeserialize(InputStream inputStream, int bufferSize, GenericType<T> type) Deserializes JSON from an InputStream with buffer size to an object of the specified generic type.<T> Tdeserialize(InputStream inputStream, int bufferSize, Class<T> type) Deserializes JSON from an InputStream with buffer size to an object of the specified type.<T> Tdeserialize(InputStream inputStream, GenericType<T> type) Deserializes JSON from an InputStream to an object of the specified generic type.<T> Tdeserialize(InputStream inputStream, Class<T> type) Deserializes JSON from an InputStream to an object of the specified type.<T> Tdeserialize(Reader reader, GenericType<T> type) Deserializes JSON from a Reader to an object of the specified generic type.<T> Tdeserialize(Reader reader, Class<T> type) Deserializes JSON from a Reader to an object of the specified type.<T> Tdeserialize(String jsonStr, GenericType<T> type) Deserializes JSON from a string to an object of the specified generic type.<T> Tdeserialize(String jsonStr, Class<T> type) Deserializes JSON from a string to an object of the specified type.voidserialize(OutputStream outputStream, Object obj) Serializes an object to JSON and writes it to an OutputStream.<T> voidserialize(OutputStream outputStream, T obj, GenericType<? super T> type) Serializes an object of a generic type to JSON and writes it to an OutputStream.<T> voidserialize(OutputStream outputStream, T obj, Class<? super T> type) Serializes an object of a specific type to JSON and writes it to an OutputStream.voidSerializes an object to JSON and writes it to a Writer.<T> voidserialize(Writer writer, T obj, GenericType<? super T> type) Serializes an object of a generic type to JSON and writes it to a Writer.<T> voidSerializes an object of a specific type to JSON and writes it to a Writer.Serializes an object to a JSON string.<T> Stringserialize(T obj, GenericType<? super T> type) Serializes an object of a generic type to a JSON string.<T> StringSerializes an object of a specific type to a JSON string.Methods inherited from interface io.helidon.builder.api.RuntimeType.Api
prototype
-
Method Details
-
create
Create a default JsonBinding instance.- Returns:
- a new JsonBinding instance with default configuration
-
builder
Return a builder for configuring JsonBinding instances.- Returns:
- a JsonBindingConfig.Builder
-
create
Create a JsonBinding instance with the specified configuration.- Parameters:
config- the configuration to use- Returns:
- a new JsonBinding instance
-
create
Create a JsonBinding instance using the provided consumer to configure it.- Parameters:
consumer- the consumer to configure the builder- Returns:
- a new JsonBinding instance
-
serialize
Serializes an object to a JSON string. If the provided object is null, returns the stringnull.- Parameters:
obj- the object to serialize, this parameter may benull- Returns:
- the JSON string representation
-
serialize
Serializes an object of a specific type to a JSON string. If the provided object is null, returns the stringnull.- Type Parameters:
T- the type of the object- Parameters:
obj- the object to serialize, this parameter may benulltype- the class type of the object- Returns:
- the JSON string representation
-
serialize
Serializes an object of a generic type to a JSON string. If the provided object is null, returns the stringnull.- Type Parameters:
T- the type of the object- Parameters:
obj- the object to serialize, this parameter may benulltype- the generic type of the object- Returns:
- the JSON string representation
-
serialize
Serializes an object to JSON and writes it to an OutputStream. If the provided object is null, writes the bytes of the stringnullto the output stream.- Parameters:
outputStream- the output stream to write toobj- the object to serialize, this parameter may benull
-
serialize
Serializes an object of a specific type to JSON and writes it to an OutputStream. If the provided object is null, writes the bytes of the stringnullto the output stream.- Type Parameters:
T- the type of the object- Parameters:
outputStream- the output stream to write toobj- the object to serialize, this parameter may benulltype- the class type of the object
-
serialize
Serializes an object of a generic type to JSON and writes it to an OutputStream. If the provided object is null, writes the bytes of the stringnullto the output stream.- Type Parameters:
T- the type of the object- Parameters:
outputStream- the output stream to write toobj- the object to serialize, this parameter may benulltype- the generic type of the object
-
serialize
Serializes an object to JSON and writes it to a Writer. If the provided object is null, writes the characters ofnullto the writer.- Parameters:
writer- the writer to write toobj- the object to serialize, this parameter may benull
-
serialize
Serializes an object of a specific type to JSON and writes it to a Writer. If the provided object is null, writes the characters ofnullto the writer.- Type Parameters:
T- the type of the object- Parameters:
writer- the writer to write toobj- the object to serialize, this parameter may benulltype- the class type of the object
-
serialize
Serializes an object of a generic type to JSON and writes it to a Writer. If the provided object is null, writes the characters ofnullto the writer.- Type Parameters:
T- the type of the object- Parameters:
writer- the writer to write toobj- the object to serialize, this parameter may benulltype- the generic type of the object
-
deserialize
Deserializes JSON from a byte array to an object of the specified type.- Type Parameters:
T- the type of the object- Parameters:
bytes- the JSON data as bytestype- the class type to deserialize to- Returns:
- the deserialized object
-
deserialize
Deserializes JSON from a byte array to an object of the specified generic type.- Type Parameters:
T- the type of the object- Parameters:
bytes- the JSON data as bytestype- the generic type to deserialize to- Returns:
- the deserialized object
-
deserialize
Deserializes JSON from a string to an object of the specified type.- Type Parameters:
T- the type of the object- Parameters:
jsonStr- the JSON stringtype- the class type to deserialize to- Returns:
- the deserialized object
-
deserialize
Deserializes JSON from a string to an object of the specified generic type.- Type Parameters:
T- the type of the object- Parameters:
jsonStr- the JSON stringtype- the generic type to deserialize to- Returns:
- the deserialized object
-
deserialize
Deserializes JSON from an InputStream to an object of the specified type.- Type Parameters:
T- the type of the object- Parameters:
inputStream- the input stream containing JSON datatype- the class type to deserialize to- Returns:
- the deserialized object
-
deserialize
Deserializes JSON from an InputStream to an object of the specified generic type.- Type Parameters:
T- the type of the object- Parameters:
inputStream- the input stream containing JSON datatype- the generic type to deserialize to- Returns:
- the deserialized object
-
deserialize
Deserializes JSON from an InputStream with buffer size to an object of the specified type.- Type Parameters:
T- the type of the object- Parameters:
inputStream- the input stream containing JSON databufferSize- the buffer size for readingtype- the class type to deserialize to- Returns:
- the deserialized object
-
deserialize
Deserializes JSON from an InputStream with buffer size to an object of the specified generic type.- Type Parameters:
T- the type of the object- Parameters:
inputStream- the input stream containing JSON databufferSize- the buffer size for readingtype- the generic type to deserialize to- Returns:
- the deserialized object
-
deserialize
Deserializes JSON from a Reader to an object of the specified type.- Type Parameters:
T- the type of the object- Parameters:
reader- the reader containing JSON datatype- the class type to deserialize to- Returns:
- the deserialized object
-
deserialize
Deserializes JSON from a Reader to an object of the specified generic type.- Type Parameters:
T- the type of the object- Parameters:
reader- the reader containing JSON datatype- the generic type to deserialize to- Returns:
- the deserialized object
-
deserialize
Deserializes a JsonValue to an object of the specified type.- Type Parameters:
T- the type of the object- Parameters:
jsonValue- the JsonValue to deserializetype- the class type to deserialize to- Returns:
- the deserialized object
-
deserialize
Deserializes a JsonValue to an object of the specified generic type.- Type Parameters:
T- the type of the object- Parameters:
jsonValue- the JsonValue to deserializetype- the generic type to deserialize to- Returns:
- the deserialized object
-