• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

How to generate JavaScript JSON object with jQuery?

Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First below codes are my spring RESTful Server controller class.

And the following codes are Ajax Java script with jquery.

The in java script prints below value.

But in restcontroller prints the following value.

I am afraid the generated json value of jquery javascript bring some error. But I hava no idea how to make proper json type value.
Any idea will be deeply appreciated. Thansk.
Posts: 67265
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JSON.stringify() is not a jQuery API, so if there were an error in generating the JSON (unlikely), the problem would not be with jQuery.

If this were my problem I'd be using the browser tools to see the request that is being sent to make sure that it contains what is expected. If it does not, then the problem would be somewhere on the front end while generating the request. If the request is as expected, the problem is likely on the back-end, perhaps with the REST mappings.
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!