-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Description
I have input to my rest API below:
{
"a":"value",
"resources": {"key1":"value1",
"key2":"value2" }
}
When I am doing
class MyModelClass {
@xmlelement(name = "resources")
@ApiModelProperty(value = "resources")
Map<String, MYClass> resources= new HashMap<String,MyClass>();
//Setters and getters for resource object.
}
Now
public class MyClass{
@XmlTransient
JSONObject pushnotificationResources = new JSONObject();
public JSONObject getPushnotificationResources() {
return pushnotificationResources;
}
public void setPushnotificationResources(JSONObject pushnotificationResources) {
this.pushnotificationResources = pushnotificationResources;
}
}
when I am loading my application I am getting the below error:
Can not instantiate value of type [simple type, class packagename.MYClass] from String value; no single-String constructor/factory method (through reference chain: com.tycoon.auth.idm.identity.model.MYModelClass["resources"])
Please help me to accept a json object with key value pairs as part of an attribute value?
like below
{"resource": {"k1":"v1","k2","v2"}}