Annotation Type JsonBody

  • @Target(PARAMETER)
    public @interface JsonBody
    Binds the body payload into POJO via json-lib.

    On a web-bound doXyz method, use this method on a parameter to get the content of the request data-bound to a bean through JSONObject.fromObject(Object) and inject it as a parameter. For example,

     public Point doDouble(@JsonBody Point p) {
       Point pt = new Point();
       pt.x = p.x*2;
       pt.y = p.y*2;
       return pt;
     public class Point { public int x, y; }
     POST ..../double
     Content-Type: application/json
     200 OK
     Content-Type: application/json;charset=UTF-8
    Kohsuke Kawaguchi