Thank you for the quick response. I did try this with groovy-all 2.3.7 and the groovy-eclipse-compiler 2.9.0-01 (which I believe is the latest.) However, I found the issue and it
was because the code was using the JsonSlurper to parse the JSON file to a String first; and then a script would try to use the JsonSlurper to parse the String (of valid JSON) to a Map type. I am not really she why this does not work because the String is
valid JSON, but see example below.
<Unit Test Setup>
InputStream stream = this.getClass().getClassLoader().getResourceAsStream(<path to a json file>)
InputStreamReader reader = new InputStreamReader(stream)
JsonSlurper slurper = new JsonSlurper()
String content = slurper.parse(reader)
<Script code>
String content = binding.variables.content
JsonSlurper slurper = new JsonSlurper()
def content = slurper.parse(reader)
assert content
The fix feels more like a work around, but it works.
<Unit Test Setup>
InputStream stream = this.getClass().getClassLoader().getResourceAsStream(<path to a json file>)
InputStreamReader reader = new InputStreamReader(stream)
JsonSlurper slurper = new JsonSlurper()
def content = slurper.parse(reader)
JsonBuilder builder = new JsonBuilder(content)
content = builder.toPrettyString()
<Script code>
String content = binding.variables.content
JsonSlurper slurper = new JsonSlurper()
def content = slurper.parse(reader)
assert content
Thanks,
Robert Brooks
From: Guillaume Laforge [glaf...@codehaus.org]
Sent: Friday, October 10, 2014 1:30 AM
To: Groovy User
Subject: Re: [groovy-user] JsonSlurp Lexing failed 1 error; after upgrading the Maven Groovy Eclipse Compiler