Package io.ebean.text.json

JSON formatting and parsing objects (See JsonContext).

The goal is to provide JSON support taking into account various ORM issues such as partial objects (for fetching and updating), reference beans and bi-directional relationships.

Example:


  // find some customers ...

 List<Customer> list = DB.find(Customer.class)
     .select("id, name, status, shippingAddress")
     .fetch("billingAddress","line1, city")
     .fetch("billingAddress.country", "*")
     .fetch("contacts", "firstName,email")
     .order().desc("id")
     .findList();

 JsonContext json = DB.json();

  // output as a JSON string
 String jsonOutput = json.toJson(list);

 
  • Interface Summary
    Interface Description
    JsonBeanReader<T>
    Provides a JSON reader that can hold a persistence context and load context while reading JSON.
    JsonContext
    Converts objects to and from JSON format.
    JsonReadBeanVisitor<T>
    Provides for custom handling of json content as it is read.
    JsonWriteBeanVisitor<T>
    Allows for customising the JSON write processing.
    JsonWriter
    Wraps an underlying JsonGenerator taking into account null suppression and exposing isIncludeEmpty() etc.
  • Class Summary
    Class Description
    EJson
    Utility that converts between JSON content and simple java Maps/Lists.
    JsonReadOptions
    Provides the ability to customise the reading of JSON content.
    JsonWriteOptions
    Provides options for customising the JSON write process.
  • Exception Summary
    Exception Description
    JsonIOException
    Unchecked exception thrown when an IOException occurs in json processing.