Package io.avaje.jsonb
Core API of Jsonb.
Initialise with defaults
Initialise with defaults
Jsonb jsonb = Jsonb.builder().build();
Initialise with some configuration
Jsonb jsonb = Jsonb.builder()
.serializeNulls(true)
.serializeEmpty(true)
.failOnUnknown(true)
.build();
fromJson
Jsonb jsonb = Jsonb.builder().build();
Jsonb jsonb = Jsonb.builder()
.serializeNulls(true)
.serializeEmpty(true)
.failOnUnknown(true)
.build();
fromJson
Read json content from: String, byte[], Reader, InputStream, JsonReader
JsonType<Customer> customerType = jsonb.type(Customer.class);
Customer customer = customerType.fromJson(content);
toJson
Write json content to: String, byte[], Writer, OutputStream, JsonWriter
JsonType<Customer> customerType = jsonb.type(Customer.class);
String asJson = customerType.toJson(customer);
-
Interface Summary Interface Description JsonAdapter.Factory Factory for creating a JsonAdapter.Jsonb Provides access to json adapters by type.Jsonb.AdapterBuilder Function to build a JsonAdapter that needs Jsonb.Jsonb.Builder Build the Jsonb instance adding JsonAdapter, Factory or AdapterBuilder.Jsonb.GeneratedComponent Components register JsonAdapters Jsonb.BuilderJsonbComponent User defined components to register custom JsonAdapters with Jsonb.Builder.JsonReader Reads json content as a stream of JSON tokens and content.JsonType<T> Provides API to serialise a type to and from JSON.JsonView<T> Represents a subset of properties that can be written as json.JsonWriter Writes json content. -
Class Summary Class Description JsonAdapter<T> The core API for serialization to and from json.Types Factory methods for types. -
Enum Summary Enum Description Json.Naming The naming convention that we can use for a given type.JsonReader.Token A structure, name, or value type in a JSON-encoded string. -
Exception Summary Exception Description JsonDataException Thrown when data being parsed is not encoded as valid json or attempting to write invalid json.JsonEofException Thrown when we hit EOF unexpectedly.JsonException Thrown when the data being parsed is not encoded as valid JSON, method invocation fails for json views, or and underlying IOException occurs.JsonIoException Thrown when underlying IOException occurred during read or write of json. -
Annotation Types Summary Annotation Type Description Json Marks a type for JSON support.Json.Ignore Exclude the property from serialization, deserialization or both.Json.Import Specify types to generate JsonAdapters for.Json.JsonAlias Define one or more alternative names for a property accepted during deserialization.Json.MixIn Mark this Class as a MixIn Type that can add Jsonb Annotations on the specified type.Json.Property Override the json property name.Json.Raw Marks a String field as containing raw JSON content.Json.SubType Specify the subtypes that a given type can be represented as.Json.SubTypes Container of all the concrete SubType's that an interface type or abstract type can be represented as.Json.Unmapped Annotate aMap<String,Object>
field to hold unmapped json properties.Json.Value Mark a method on an Enum that provides the json value.