Add number to a JSON template

Hi,

I have the following simplified template. template.

`
{
“payment”: {
“amount”: “#{totalAmount}”
}
}

`

I want the amount to be a decimal. Is that possible? I tried to do it without the quote but it was giving me an error.

`
{
“payment”: {
“amount”: #{totalAmount}
}
}

`

Thanks.

What’s this #? Gatling EL uses $, not #.

Oops. Sorry I was playing around with it. So when I change it to this:

`

`
{
“payment”: {
“amount”: “${totalAmount}”
}
}

`

`

I get this:

`

`
{
“payment”: {
“amount”: “100”
}
}

`

`

`
{
“payment”: {
“amount”: 100
}
}

`

Is that possible? Or it really doesn’t matter in JSON?

Don’t confuse Javascript objects and JSON which is just plain text serialization. Gatling EL deals with plain text, so you’re the one in charge of properly designing your template and passing proper values. If you want your JSON to describe a decimal, you must wrap with double quotes as this describes strings.