How to send ajax request data as a class to Spring mvc controller?
<p>I am sending an AJAX request to a Spring MVC controller, like this:</p>

<pre><code>var filters = {
    visual: visual, 
    Name: params['Name'], 
    Address: params['Address'], 
    documentType: params['documentType'], 
    itemQualifier: getItemQualifier(),
    itemIdentifier: params['itemIdentifier'], 
    currency: getCurrency(), 
    sellSide: getSellSide()
};

$.ajax({                                                                    
    type: "POST",
    url: "/reports/savefilters",
    data: filters,
    success: function(response) {
        alert('filters saved successfully: ' + response);
    },
    error: function(e) {
        alert('Error while saving filters: ' + e.message);
    }
});
</code></pre>

<pre class="lang-java prettyprint-override"><code>@RequestMapping(value = "/savefilters", method = RequestMethod.POST)
public @ResponseBody String saveFilters(@RequestParam("visual") String visual, @RequestParam(value = "Name[]", required = false) String[] Name, 
        @RequestParam(value = "Address[]", required = false) String[] Address, @RequestParam(value = "documentType[]", required = false) String[] documentType, 
        @RequestParam("itemQualifier") String itemQualifier, @RequestParam(value = "itemIdentifier[]", required = false) String[] itemIdentifier, @RequestParam("currency") String currency,
        @RequestParam("sellSide") String sellSide, HttpServletRequest request)
{
    try
    {
        System.out.println("saveFilters");
        new DisplayService().saveFilters("ID", visual, Name, Address, documentType, itemQualifier, itemIdentifier, currency, sellSide);
        return "success";
    }
    catch (Exception ex)
    {
        return "error occured while inserting/updating db";
    }
}
</code></pre>

<p>I want to pass all these arguments as a class instead of sending like this. </p>

<p>How can I pass as a class from an AJAX call and how do I receive it in the Spring MVC controller code? Any suggestions please? Thanks.</p>