package jp.eiya.aya.gson public class MyClass{ private String id=null private int value=0 public MyClass(String i,int v){ id=i value=v } public String getID(){return id} public int getValue(){return value} } import com.google.gson.* import jp.eiya.aya.gson.MyClass def gson = new Gson() def test=new MyClass("test" , 1) def json=gson.toJson(test) assert(json == /{"id":"test","value":1}/) MyClass tes