Array of Objects Drizzle

Hey there, can anyone help me with an issue on Drizzle Studio? On my schema, I have a question table with a answers field that I defined like this: answers: json('answers').array() But when I run drizzle studio and I try to add an object inside of an array it gives me an error saying malformed array literal, does anyone know what is the correct syntax to add it manually there on the drizzle studio? And also to add it through the code using insert ?
4 Replies
JulieCezar
JulieCezar7mo ago
try this:
[
{"id": 2, "info": {"name": "John", "surname": "Smith"}, "age": 25},
{"id": 5, "info": {"name": "Jane", "surname": "Smith"}, "dob": "2005-11-04T12:00:00"}
]
[
{"id": 2, "info": {"name": "John", "surname": "Smith"}, "age": 25},
{"id": 5, "info": {"name": "Jane", "surname": "Smith"}, "dob": "2005-11-04T12:00:00"}
]
Lycurgian
LycurgianOP7mo ago
even like this I get the same error, how do you declare this field on your schema to be able to pass input like this on drizzle studio ?
No description
JulieCezar
JulieCezar7mo ago
try to do it programatically insted of with the studio I am using JSON and it works fine
Lycurgian
LycurgianOP7mo ago
turns out it was an issue on Drizzle Studio and it is now fixed
Want results from more Discord servers?
Add your server