I want to define the following json string using jsonbuilder..
{
"a":"a",
"b":"b",
"c":{"d":"d",
"e":"e",
"f":{"g":"g"}
}
}
I can't seem to define the property f as an embedded object, this is my attempt...
import groovy.json.JsonBuilder
def builder = new JsonBuilder()
builder{
a 'a'
b 'b'
c(
d: 'd',
e: 'e',
f:(
g: 'g'
)
)
}
log.info(builder.toString())
I get compilation error unexpected token expected ) but got : at line 10 Any help would be much appreciated.