I have written a java REST web service using Apache cxf and spring framework. My service is correctly producing XML. But when I change from Media type from XML to JSON I get following output
No message body writer has been found for class java.util.ArrayList, ContentType: application/json
Do I need to use any other library such as Jackson ( I don't know what it is ) to produce JSON. Here is my model class
package au.com.fxa.sfdc.custdocs.Model;
import java.math.BigDecimal;
import java.util.Date;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement
public class Statement
{
    private Date statementDate;
    private BigDecimal totalAmount;
    private String imageLocation;
    private String accountNumber;
    public Statement(){}
    public Date getStatementDate()
    {
        return this.statementDate;
    }
//    public String getFormattedStatementDate()
//    {
//        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
//        return sdf.format(this.statementDate);
//    }
    public BigDecimal getTotalAmount()
    {
        return this.totalAmount;
    }
    public void setStatementDate(Date statementDate)
    {
        this.statementDate = statementDate;
    }
    public void setTotalAmount(BigDecimal totalAmount)
    {
        this.totalAmount = totalAmount;
    }
    public String getImageLocation()
    {
        return this.imageLocation;
    }
    public void setImageLocation(String imageLocation)
    {
        this.imageLocation = imageLocation;
    }
    public String getAccountNumber() {
        return accountNumber;
    }
    public void setAccountNumber(String accountNumber) {
        this.accountNumber = accountNumber;
    }
}
Here is the code under my service method
@GET
    @Path("{custid}/statements")
    @Produces({MediaType.APPLICATION_JSON})
    @Consumes({"application/x-www-form-urlencoded"})
    public List<Statement> getStatementsListByAccountId(
            @PathParam("custid") String account,
            @DefaultValue("") @QueryParam("fromdate") String fromDate,
            @DefaultValue("") @QueryParam("todate") String toDate) throws Exception {
        Date from = null;
        Date to = null;
        SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
        if(!fromDate.equals(""))
        {
            from = formatter.parse(fromDate);
        }
        if(!toDate.equals(""))
        {
            to = formatter.parse(toDate);
        }
        ArrayList<Statement> statements = (ArrayList<Statement>) CustomerBiz.getStatements("Statements",account,from,to);
        return  statements;
    }
What am I missing ??