'Malformed Array Literal' Error when inserting dataStruct List into JSONB column in Supabase

Actions & Logic

I've been trying to be able to insert a list of data type items into a 'jsonb' column (not an array) in Supabase. It works for certain items following the same data structure, but not for others. I've made it so dateTimes convert to UTC, then to ISO8601 string. I keep getting a variant of this 400 POST error in my console logs saying usually something like this: "code": "22P02",

   "code": "22P02",
    "details": "\"[\" must introduce explicitly-specified array dimensions.",
    "hint": null,
    "message": "malformed array literal:

The things I'm trying to convert to json for insert are a list of data type items with this Shcema:

itemID: string
orderIndex: Int
title: string
note: string
isCompleted: bool
completedAt: dateTime
isRequired: bool

What have you tried so far?

I have used the 'Create JSON Map' function and created a custom map with all the proper key/value pairs, and made sure to convert 'completedAt' dateTime to UTC and to a string with ISO8601. This gives me an error.

I have created a function that takes the item dataStruct list as an argument, converts makes changes like dateTime to UTC and to ISO8601 string, then converts this all to a JSON output. I still get an error.

I have tried different variatiosn of this function, one that makes it a json list, then used a listToJson function wrapped around it.

I've tried just putting in the list variable, and having it mapped to JSON.

For some reason, these methods work in one table of my DB, where dateTime is not included, but does nor work on another. I have checked the date type in Supabase, I feel like I have tried everything. I've even tried not including the dateTime in the one that doesn't work and I still get the same thing.

ChatGPT and Claude both say that FlutterFlow is trying to put in a string, but I have no idea why.
What is going wrong???

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