Dynamodb putitem in case no value

I'm building a dashboard on retool to add data to dynamodb table.
Here is the putitem query I used to put item in the dynamodb table:

{
    "operator": {{Number(operator.value)}},
    "id": {{Number(id.value)}},
    "active": {{active.value}},
    "gateway": {{gateway.value}},
    "revenue": {{Number(revenue.value)}},
    "service": {{Number(service.value)}}
}

This issue is sometimes there is no data in revenue or service. in this case when I click on submit buttom I see it sent the data like this:

{
    "operator": 2,
    "id": 3,
    "active": ture,
    "gateway": test,
    "revenue": 0,
    "service": 0
}

But I need to remove the revenue and the service is case no value in the text editor to be like this:

{
    "operator": 2,
    "id": 3,
    "active": ture,
    "gateway": test
}

Hi @ahmedfawzy Thanks for reaching out! You should be able to use a ternary to skip any key value pairs that you don't need!

Something like this: {{service.value ? "service:" : null }}: {{Number(service.value)}}