parse/extract json, so u are using the wrong functionsjson_extract
json_extract(${usersTable.settings}, '$')settings
:
"{\"hello\":[\"world\",\"there\"]}"SELECT json_extract('{"hello":["world","there"]}', '$.hello');'["world","there"]'SELECT json_extract('{"hello":["world","there"]}', '$');'{"hello":["world","there"]}'console.log(JSON.parse(user?.settings?.hello))message: "undefined" is not valid JSONconsole.log(JSON.parse(user?.settings))

wrangler d1 execute your-db —command="SELECT json_extract(…) FROM yourtable" is a good way to experiment.

wrangler and have it run commands/import files for youwrangler dev in remote mode against your live DBunstable_dev() API to set up everything for testing.parse/extract jsonjson_extractjson_extract(${usersTable.settings}, '$')settings
:
"{\"hello\":[\"world\",\"there\"]}"SELECT json_extract('{"hello":["world","there"]}', '$.hello');'["world","there"]'SELECT json_extract('{"hello":["world","there"]}', '$');'{"hello":["world","there"]}'console.log(JSON.parse(user?.settings?.hello))message: "undefined" is not valid JSONconsole.log(JSON.parse(user?.settings))wrangler d1 execute your-db —command="SELECT json_extract(…) FROM yourtable"describe("backend json rest api", () => {
let worker;
before(async () => {
worker = await unstable_dev("src/index.ts", {
experimental: { disableExperimentalWarning: true },
});
});
after(async () => {
await worker.stop();
});
// ... actual tests here
});