Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8609055
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T03:46:45+00:00 2026-06-12T03:46:45+00:00

Client code: $.ajax({ type: POST, url: ../web/zittles, data: jsonformatdata, contentType: application/json, dataType: json, success:

  • 0

Client code:

$.ajax({
        type: "POST",
        url: "../web/zittles",
        data: jsonformatdata,
        contentType: "application/json",
        dataType: "json",
    success: function(data)
        {
        alert("data from server : "+data);
        },
        error: function(jqXHR, textStatus, errorThrown)
        {
            alert("jqXHR.status = "+jqXHR.status); //getting status code 400 here
        }        
});

Output json data:

{
        "id": 1,
        "No": "1234",
        "Desc": "Testing"
}

Java class:

public class Fizzle implements Serializable
{
    private String id;
    private String No;
    private String Desc;
    // getters and setters 
}

Spring 3 Controller:

@RequestMapping(value = '/zittles', method = RequestMethod.POST, headers ="Content-Type=application/json")
    public @ResponseBody void doSomeThing (@RequestBody Fizzle fizzle) {

        //do something here
}

app-servlet.xml has

<mvc:annotation-driven/>

/lib folder of tomcat has

jackson-core-lgpl-1.9.10.jar
jackson-mapper-lgpl-1.9.10.jar

Getting error with status code 400 –

"The request sent by the client was syntactically incorrect"

When I change the Controller code as shown below, it takes the json data as string.

public @ResponseBody void doSomeThing (@RequestBody String fizzle) {}

Ideally Jackson should automatically map the json data to Fizzle object.

What is it that I am missing here. Is there anything else that has to be done to configure the Jackson parser correctly?

Help please.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T03:46:47+00:00Added an answer on June 12, 2026 at 3:46 am

    I am answering my own question since it worked for me. Thanks “vacuum” for giving me the direction. I am using List since I am receving an array of json data.

    @JsonTypeName
    @RequestMapping(value = '/zittles', method = RequestMethod.POST, headers ="Content-Type=application/json")     
    public @ResponseBody void doSomeThing (@RequestBody String fizzles) 
    {          
         //do something here
         ObjectMapper mapper = new ObjectMapper();
         ArrayList list = mapper.readValue(new StringReader(fizzles), ArrayList.class);
         List<Fizzle> fizzles1 = mapper.convertValue(list, new TypeReference<List<Fizzle>>() {});
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here's my client-side jQuery code: $.ajaxSetup ({ contentType: application/json, datatype: 'json' }); $.ajax({ type:
Client code is pretty simple: <form action=DDServlet method=post> <input type=text name=customerText> <select id=customer> <option
I have the JS-code: $(#select_bank).change(function () { selected_bank = $(#select_bank option:selected).text(); $.ajax({ type: 'POST',
I have aproblem with a AJAX POST via jQuery. Here is the client code:
Let's say I have the following jQuery AJAX call: $.ajax({ type: POST, url: MyUrl,
I am trying to call an MVC method via Ajax. The code on client
I added <script type=text/javasript src=<?=base_url()?>js/jquery-1.7.2.min.js></script> in application/views/templatess/header.php and to post data to Controller using
Am trying to post json data to the server. am using visual studio 2012
I have the following code on the client side for retrieving data from the
I am using jQuery.ajax(...) to retrieve JSON data from an ASP.NET MVC service. When

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.