def output = new groovy.json.JsonOutput() def testString = "test_string" println output.toJson(testString) // outputs valid JSON: "test_string"