Unexpected token } at the end of json response

I store json object as varchar in database.

There strange thing is that excess ending brace is added to the end of the only one of my json objects(from thousands).

I see the bug in chrome & firefox. In firefox console error is the following:

SyntaxError: JSON.parse: unexpected non-whitespace character after JSON data. In chrome the error is: Uncaught SyntaxError: Unexpected token }

While debugging I assured that myjson string that i return from grails controller is without that excessed '}' .

I render json from controller by the following code:

render(text:shape?.geojson, contentType:"application/json", encoding:"UTF-8")

Also, the problem is not in javascript, as i get not valid json by get request.

What could be the cause of such a strange behaviour? Thanks in advance.


我设置contentType后,该bug被修复:“text / json”而不是“application / json”

链接地址: http://www.djcxy.com/p/45946.html

上一篇: $ .parseJSON给出“Uncaught SyntaxError:意外的标记”

下一篇: 意外的令牌}在json响应结束时