Win a copy of Serverless Applications with Node.js this week in the NodeJS forum!
  • 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
  • Bear Bibeault
  • Jeanne Boyarsky
  • paul wheaton
  • Junilu Lacar
  • Paul Clapham
  • Knute Snortum
Saloon Keepers:
  • Stephan van Hulst
  • Ron McLeod
  • Tim Moores
  • salvin francis
  • Carey Brown
  • Tim Holloway
  • Frits Walraven
  • Vijitha Kumara

How to generate JavaScript JSON object with jQuery?  RSS feed

Ranch Hand
Posts: 32
  • 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: 67255
IntelliJ IDE Java jQuery Mac Mac OS X
  • 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.
a wee bit from the empire
global solutions you can do at home or in your backyard
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!