WindmillWWindmill
Powered by
ShenanigansS
Windmill•10mo 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[]
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\"}"}
{"{\"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[]
JSON[]
type.

Parsing this result via
JSON.parse()
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"
    }
}
{
    "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[]
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
Windmill EE v1.483.1-18-g444a6abad
WindmillJoin
3,362Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements
Recent Announcements
henri-c

Weekly kenote to tell you about our latest updates https://discord.com/channels/930051556043276338/1278977038430240813 https://youtube.com/live/2dGd9TdT8xs?feature=share

henri-c · 5d ago

Pyra

### HTTP tracing (EE) Capture HTTP requests made by job scripts as observability spans Features: - View HTTP request traces (method, URL, status, timing) in the job details UI - Auto-instrumentation for Native TypeScript, MITM proxy for other languages - Integrates with external OpenTelemetry collectors changelog: https://www.windmill.dev/changelog/http-tracing docs: https://www.windmill.dev/docs/advanced/instance_settings#http-tracing Additionally jobs memory metrics are now fully OSS!

Pyra · 2w ago

henri-c

First keynote of the year here https://discord.com/channels/930051556043276338/1278977038430240813 🙂

henri-c · 4w ago

Similar Threads

GQL call requires SiteLocale as a string parameter but windmill infers its type as an object
RicoRRico / help
3y ago
MySQL script: invalid type: string "", expected a boolean
andr04.Aandr04. / help
3y ago
Database Studio Table thinks my Postgres bigint column is a string
hmansHhmans / help
16mo ago
After upgrading windmill, we are now seeing this error "string too long to represent as jsonb string
RicoRRico / help
2y ago