Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 1.8.0
-
Fix Version/s: 1.8.1, 1.9-beta-1
-
Component/s: JSON
-
Labels:None
-
Environment:Gentoo Linux (amd64) / sun-jdk 1.6.0_26
-
Testcase included:yes
-
Number of attachments :
Description
The JsonSlurper does not appear to handle backslash characters () even if they have been properly escaped.
Using this sample pieced together from the Groovy 1.8.0 Release Notes:
import groovy.json.* def json = new JsonBuilder() json.person { name "Guill\\aume" age 33 pets "Hector", "Felix" } def jsonstring = json.toString() println jsonstring def slurper = new JsonSlurper() def doc = slurper.parseText(jsonstring) println doc
$ groovy json.groovy
{"person":{"name":"Guill\\aume","age":33,"pets":["Hector","Felix"]}}
Caught: groovy.json.JsonException: Expected a value on line: 1, column: 69.
But got an unterminated object.
at json.run(json.groovy:15)
Have tried this with 1.8.0, 1.8.1 Snapshot (2011-06-13), 1.9.0 Snapshot (2011-06-13)
Sorry, new to both groovy & jira, have attached my code example.