yasson

yasson

JSON support via yasson library.

exports

dependency

<dependency>
  <groupId>org.jooby</groupId>
  <artifactId>jooby-yasson</artifactId>
  <version>1.6.6</version>
</dependency>

usage

import org.jooby.json.Yasson;

{
  use(new Yasson());
 
  // sending
  get("/my-api", req -> new MyObject()); 

  // receiving a json body
  post("/my-api", req -> {
    MyObject obj = req.body(MyObject.class);
    return obj;
  });

  // direct access to Jsonb
  get("/access", req -> {
    Jsonb jsonb = require(Jsonb.class);
    // ...
  });
}

configuration

If you need a special setting or configuration for your json-b:

{
  use(new Yasson().doWith(builder -> {
    builder.withFormatting(true);
    // ...
  });
}