Module io.jooby.gson


module io.jooby.gson
JSON module using Gson: https://github.com/google/gson.

Usage:


 {

   install(new GsonModule());

   get("/", ctx -> {
     MyObject myObject = ...;
     // send json
     return myObject;
   });

   post("/", ctx -> {
     // read json
     MyObject myObject = ctx.body(MyObject.class);
     // send json
     return myObject;
   });
 }
 
For body decoding the client must specify the Content-Type header set to application/json.

You can retrieve the Gson object via require call:


 {

   Gson gson = require(Gson.class);

 }
 
Complete documentation is available at: https://jooby.io/modules/gson.
Since:
2.7.2
Author:
edgar
  • Packages

    Exports
    Package
    Description
    JSON module using Gson: https://github.com/google/gson.