I am trying to set the variable MY_VARIABLE in a json object.
* def MY_VARIABLE = 'USER_1'
* def loginRequestJson = { user: MY_VARIABLE , name: 'Some Name'}
* print loginRequestJson
but it outputs MY_VARIABLE as a string literal and not the the value from MY_VARIABLE as I expected.
{ "user": "MY_VARIABLE", "name": "Some Name" }
I know I can do string concatenation, but this starts looking messy with more than 5 variables.
* def loginRequestJson = "{ 'user': "+ MY_VARIABLE +" , 'name': 'Some Name'}"
Is there a more elegant way of getting my variable into the json?
PS Maybe I am thinking in a Pythonic way with dictionaries which may have not been the intention.