Openai JSON api body - FlutterFlow string list to JSON

Database & APIs

Hi,

I'm fairly new to flutterflow and I've spent a fair bit of time researching this (doc, community, etc).

I'm having trouble transposing the list string to JSON format. the API keeps returning error (not properly formated)

What have you tried so far?

The user in the app, can select for example apples and pears as fruits. This is saved as a String list in the app called "fruits"

for the API i've created a variable called "fruits", type "JSON" (also trid "STRING"), and tried to set is list to true and false (both options...different tests).


From what I've seen, the JSON format expects the list to look like this: [\"apples\",\"pears\"].

From flutterflow, whatever I can pass from that string list looks like this: ["apples","pears"], which causes the error.

If I test the api call and the "\" in the test variable, everything works, as expected.


How can I transform the data to make it conform to the JSON standard?

Did you check FlutterFlow's Documentation for this topic?
Yes
1
2 replies