This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes Groovy and the fly likes Help with deserializing JSON to Grails Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Languages » Groovy
Bookmark "Help with deserializing JSON to Grails" Watch "Help with deserializing JSON to Grails" New topic

Help with deserializing JSON to Grails

Hugo Alberto Bedolla

Joined: Nov 09, 2010
Posts: 17
Hello everybody:

Having a problem when readin a JSON object into my controller.

when using

println params

basically I get this output:

[application[prospect][contact]:kkkk, application[prospect][SSN]:ABC123456AB0, application[applicationDate]:Tue Apr 02 2013 09:22:06 GMT-0600, application[prospect][name]:ANAMEHERE, application[prospect][address]:The Address, action:saveApplication, controller:screenApplication]

So I know there is the object.

When trying to access my object using:

println params["application"]

I get:


When trying to access any of its properties in this way:


I get:


When trying to "deserialize" using

def jsonobject = new JSONObject(JSON.parse(params["application"]))

I get:


What am I doing wrong when accesing the parameters?

Kind regards

UPDATE: problem solved: It was when serializing the object to JSON with Javascript (Not proper serializing but passing the object "as is").
I agree. Here's the link:
subject: Help with deserializing JSON to Grails
Similar Threads
My AJAX Chained Selector Function (Enjoy!)
How to get url
paramsPrepareParams OgnlException setProperty()
struts2 ( json result type problems
Obtaining JSON object using params in grails REST