将具有Java中数据类型对象的成员变量的类编组

时间:2018-08-01 09:02:38

标签: java serialization jaxb marshalling

我想安排这堂课:

public class PrimCon {


    private Object any;


    public Object getAny() {
        return any;
    }


    public void setAny(Object any) {
        this.any = any;
    }

}

用于编组:

PrimCon p= new PrimCon();
p.setAny("sdghedrseaengd");
marshaller.marshal(p, System.out);

Output is : 
{
   "any" : {
      "type" : "string",
      "val" : "sdghedrseaengd"
   }
}

我的问题是如何在输出中删除“ type”:“ string”

0 个答案:

没有答案