How to custom json body when using api call?

Database & APIs
Resolved

Hello everyone,

I have a problem with an API call where I use JSON body to pass values. Sometimes the variables have values, and sometimes they don't. How can I exclude a variable when it has no value? For example, I want to send this when eventTypes has values:

{ "eventTypes": [ "type1", "type2" ], "pageIndex": "<integer>", "pageSize": "<integer>" }

But when eventTypes has no values, I want to send this:
{ "pageIndex": "<integer>", "pageSize": "<integer>" }

What have you tried so far?

ask chatgpt, search docs, find solution in community

Did you check FlutterFlow's Documentation for this topic?
No
2
3 replies