java - using map in pojo object not mapping the request -
i creating restful apis. doing @post
call , request body below:
{ "user": "test1", "animals": { "cat": "3", "dog": "5", "cow": "10" } }
service :
@path("/saveownerdata") @post @produces({ "text/html", "application/json", "application/text" }) public response saveownerdata(ownerdata ownerdata) { //save db }
entity object:
@xmlrootelement @entity(value = "ownerdata", noclassnamestored = true) public class ownerdata { @id private string _id; private string user; private map<string, string> animals; public string get_id() { return _id; } public void set_id(string _id) { this._id = _id; } public string getuser() { return user; } public void setuser(string user) { this.user = user; } public map<string, string> getanimals() { return animals; } public void setanimals(map<string, string> animals) { this.animals = animals; }
}
questions:
- the request mapping "user" data not "animals" data
- i tried org.codehaus.jettison.json.jsonobject well, same issue
- if can't map or json object, how can map kind of request directly pojo
thanks in advance.
Comments
Post a Comment