JSON parse limitation

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

JSON parse limitation

Sohaiba Qazi
We have grails 2.2.4 application running on Tomcat that works with user camera and keystrokes, collects some data on the client side with Javascript and sends using POST.

In the grails controller we have the following line to parse the JSON:

def data = JSON.parse(params.testResults)

Everything works as expected expect for when the user takes longer than normal and puts in lots of keystrokes. The errors looks something like:

2014-06-14 01:22:14,323 [http-8443-16] ERROR (org.codehaus.groovy.grails.web.errors.GrailsExceptionResolver) - JSONException occurred when processing request: [POST] /qbcheck/customer/thankYou
Expected a ',' or ']' at character 524288 of {"patkey":"","test_version":"1.4","data_version":"1.3","patientid":"","test_date":"","test_duration":0,"gender":"","dob":"","fov":62,"fps":26,"scale_factor":0,"country":46,"camera_data":{"x":[353,353,353,353,3......

It always fails at character 524288. This led us to investigate that there might be a limit on the amount of data, we looked at Tomcat and found that it allows 2MB data by default using maxpostsize property. Still we updated it to a bigger number just to be sure. Similarly, we tried looking on Grails and JS side but were not able to find any limitation.

We are wondering if this is a Grails-related issue. Looking for any pointers in this regard. We are able to provide more details as required.