Unable to reference local variable with JsonBuilder

I have the following code

The addTicketCommand object is not null on line 2 yet is undefined within the JsonBuilder closure. Is it not possible to access local variables in groovy from within closure?

You should be able to access addTicketCommand inside the closure as below. Mark the use of “parenthesis” instead of “curly” braces.