Package io.avaje.jsonb


package io.avaje.jsonb
Core API of Jsonb.

Initialise with defaults


   Jsonb jsonb = Jsonb.builder().build();
 

Initialise with some configuration


   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);

 
See Also:
  • Class
    Description
    Marks a type as a basic user-provided JsonAdapter to be registered automatically.
    Marks a type for JSON support.
    Define one or more alternative names for a property accepted during deserialization.
    Exclude the property from serialization, deserialization or both.
    Specify types to generate JsonAdapters for.
     
    Deprecated.
    - migrate to Json.Alias.
    Mark this Class as a MixIn Type that can add Jsonb Annotations on the specified type.
    The naming convention that we can use for a given type.
    Override the json property name.
    Marks a String field as containing raw JSON content.
    Specify the subtypes that a given type can be represented as.
    Container of all the concrete SubType's that an interface type or abstract type can be represented as.
    Annotate a Map<String,Object> field to hold unmapped json properties.
    Mark a method on an Enum that provides the json value.
    The core API for serialization to and from json.
    Factory for creating a JsonAdapter.
    Provides access to json adapters by type.
    Function to build a JsonAdapter that needs Jsonb.
    Build the Jsonb instance adding JsonAdapter, Factory or AdapterBuilder.
    Components register JsonAdapters Jsonb.Builder
    User defined components to register custom JsonAdapters with Jsonb.Builder.
    Thrown when data being parsed is not encoded as valid json or attempting to write invalid json.
    Thrown when we hit EOF unexpectedly.
    Thrown when the data being parsed is not encoded as valid JSON, method invocation fails for json views, or and underlying IOException occurs.
    Thrown when underlying IOException occurred during read or write of json.
    Reads json content as a stream of JSON tokens and content.
    A structure, name, or value type in a JSON-encoded string.
    Provides API to serialise a type to and from JSON.
    Represents a subset of properties that can be written as json.
    Writes json content.
    Factory methods for types.