Vasantha Raj Vasantha Raj - 4 months ago 35x
JSON Question

jersey 2.x Moxy json does not support POJO list

I am new for jersey, while i am trying to receive data from jquery to java using ajax it doesn't map pojo.


public class RulesTO {

private int ruleId;
private String ruleName;
private int ruleStudioId;
private String ruleStudioName;
private String ruleDescription;
private Boolean ruleStatus;
private List<SitesTO> siteRule;
private List<IspsTO> ispRule;
private List<CountriesTO> countryRule;
private String studioDefaultRule;

//getters and setters

Ajax :-

var rulesTO = {
ruleName : $('#ruleName').val(),
ruleStudioId : $('#studios option:selected').attr("stream"),
ruleStudioName : $('#studios option:selected').text(),
ruleDescription : $('#ruledescription').val(),
ruleStatus : false,
siteRule : newSiteObject,
ispRule : newIspObject,
countryRule : newCountryObject,
studioDefaultRule : newStudioDefaultObject

url : "/idns/idnsData/saveConfiguration",
type : "POST",
contentType : "application/json",
dataType : "json",
data : JSON.stringify(rulesTO),
success : function(data){
alert("success insert");


public class IdnsDataHandler {

private static Logger logger = Logger.getLogger(IdnsDataHandler.class);
private Connection connection = null;

public RulesTO saveConfiguration(RulesTO rulesTO) throws Exception{
try{"IdnsDataHandler : saveConfiguration Method start");
System.out.println("Rule Id : "+rulesTO.getRuleId());
System.out.println("Rule Name : "+rulesTO.getRuleName());
System.out.println("Studio Id : "+rulesTO.getRuleStudioId());
System.out.println("Studio Name : "+rulesTO.getRuleStudioName());
System.out.println("Rule Description : "+rulesTO.getRuleDescription());
System.out.println("Rule Status : "+rulesTO.isRuleStatus());
System.out.println("List Site : "+rulesTO.getSiteRule().size());
System.out.println("List Isp : "+rulesTO.getIspRule().size());
System.out.println("List Country : "+rulesTO.getCountryRule().size());
System.out.println("List studioDefault : "+rulesTO.getStudioDefaultRule());

List<SitesTO> takeall = rulesTO.getSiteRule();
for(int i=0;i<takeall.size();i++){

output :-
Rule Id : 0
Rule Name : example
Studio Id : 3
Studio Name : MAsia
Rule Description : test
Rule Status : false
List Site : 5
List Isp : 0
List Country : 0
List studioDefault : null

but i want List site object and values map to the POJO, but does not work. please kindly help me, this is very useful for my project. thank you

check the dependencies for Moxy json, Thats work for me.