ShenanigansS
Windmill9mo ago
1 reply
Shenanigans

JSON[] Postgres type renders as string with extra brackets

Hello, not sure if my title explains the issue well, but I am using the database studio with postgre db. My column types are in JSON[].

The studio renders the following ({"{\"fieldA\":{\"Size\":2.4},\"title\":null,\"width\":48,\"height\":32,\"quantity\":1,\"date\":\"2025-03-29 02:56:02.000000 +00:00\",\"itemNumber\":1,\"itemsTotal\":1,\"item1\":\"1234\"}"}) in the columns with JSON[] type.

Parsing this result via JSON.parse() in scripts/flows yields the following error:

{
    "error": {
        "name": "SyntaxError",
        "stack": "SyntaxError: JSON Parse error: Expected ':' before value in object property definition
    at <parse> (:0)
    at parse (unknown)
    at <anonymous> (/tmp/bun/main.js:5:34)
    at main (/tmp/bun/main.js:3:21)
    at <anonymous> (/tmp/bun/wrapper.mjs:23:26)
    at run (/tmp/bun/wrapper.mjs:16:19)
    at /tmp/bun/wrapper.mjs:29:11
    at <anonymous> (native:2)",
        "message": "JSON Parse error: Expected ':' before value in object property definition",
        "step_id": "myFlowStep"
    }
}


I had to change the db schema to JSON[] as I encounted an error where the brackets around my object weren't interpreted properly

Is there a way/setting I can apply to solve this?

Thank you

Windmill Version: Windmill EE v1.483.1-18-g444a6abad
Was this page helpful?