from PHP application there is call to grails controller which sends data in JSON format.
when i println the params
println params
which prints
[{"courseCategory":null,"courseId":null,"show":null,
"rows":6,"trainers":null,"courses":null,"cities":null,
"fromDate":null,"toDate":null,"pageType":"HOME","deal":null}:,
action:getTrainingsAsJson,
controller:publicTraining]
when i do
println params.rows
println params.pageType
which prints null
i tried
def jsonObject = request.JSON // prints [:]
I have also tried with JsonSlurper
def slurper = new JsonSlurper()
def result = slurper.parseText(params)
which gives error
No signature of method: groovy.json.JsonSlurper.parseText() is applicable for argument types: (org.codehaus.groovy.grails.web.servlet.mvc.GrailsParameterMap)
how to convert it to retrieve the param values?
or is there any way to convert it to map so that i can easily access the parameters?
If it is a POST request then the JSON can be retrieved from request
as
request.JSON
request.JSON.courseCategory
etc
What is see from the request the values are sent null
from the client. Verify the payload.