Json deserialization for java object -
i have class contains java object, contains other classes ignoring now
class { b b; } class b { string name; object value; // value can string, list or int //setters, getters name public void setvalue(object value) {this.value = value;} public object getvalue() { return this.value;} } i taking input json api using jaxr, this:
@consumes(mediatype.application_json) public response getdata(a a) throws jsonprocessingexception { a.getb().getvalue(); } the problem getvalue() returns elementnsimpl object, want return java object can check instance , create objects accordingly.
this how json input like:
{ b: { "name": "product", "value": "thisisstring" // want create string class. or "value": ["item1", "item2"] // list class or "value": 232 // int class }
Comments
Post a Comment