Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
2.0.0
-
None
-
window 7
Description
def builder = new groovy.json.JsonBuilder() def root = builder.people { firstName 'Guillame' lastName 'Laforge' married true conferences 'JavaOne', 'Gr8conf' blank '' } println builder.toString() println builder.toPrettyString() String s = '""' println "$s" println "${s[1..-2]}" println "${StringEscapeUtils.escapeJava(s[1..-2])}"
output
{"people":{"firstName":"Guillame","lastName":"Laforge","married":true,"conferences":["JavaOne","Gr8conf"],"blank":""}} { "people": { "firstName": "Guillame", "lastName": "Laforge", "married": true, "conferences": [ "JavaOne", "Gr8conf" ], "blank": "\"\"" } } "" "" \"\"
I think there is a bug on file "D:\groovy-src-2.0.4\groovy-2.0.4\subprojects\groovy-json\src\main\groovy\groovy\json\JsonOutput.groovy"
line 190-192
} else if (token.type == STRING) { output.append('"' + StringEscapeUtils.escapeJava(token.text[1..-2]) + '"')