Hi,
I'm trying to parse a JSON using Grails, to test the parser I Wrote an unit test and put my input JSON in a GString that looks something like this:
"""{"Information":"Some data here \"stuff\" some more.","AnswerToEverything":42,"Other":71,"Name":"Joe Doe"}"""
The \"stuff\" is causing the parser to break.
I tried using String.replace(/\\"/, "")
and a few other combinations to remove the \" but it either does nothing or removes all the quotes from the string.
This post tells me that I need to use 5 slashes: \\\\\"
to get it to work in Java but it isn't working in Groovy.
Edit: This test should pass for it to work:
str = """foo \"foobar\" bar"""
assert str.replace("""\\\"""", "") == "foo foobar bar"
With the above regex it fails.
Any tips?