JSON as Lists column data type

LabKey Support Forum
JSON as Lists column data type kotlenik  2021-12-27 10:05
Status: Active
 

Hi guys,
I am exploring LabKey Server (dockerized community version 21.10.0, PostgreSQL as database)
for some features needed by my client, among others - custom JSON data for each entity recorded in list.
I was able to find TEXT column data type as an option to record custom JSON content for record in list,
practically as string.
Keeping in mind that these are options to use JSON specific functions within PostgresSQL,
https://www.labkey.org/Documentation/wiki-page.view?name=labkeysql#postgresJson
could you guide me towards material, or give me advice about alternative and more appropriate
ways to record and query back JSON in list records - through a more specific column data type, or
some other way?
Cheers and thanks,
Adam

 
 
kotlenik responded:  2022-01-14 02:29

Hi guys,
we may close this thread. Steve Hanson helped me advising that SQL scripts module
https://www.labkey.org/Documentation/wiki-page.view?name=sqlScripts
could be used to construct custom JSON based columns in PostgreSQL database and use within
LabKey. Thanks Steve!
Cheers,
Adam

 
jeckels responded:  2022-01-14 09:16

I'm glad that you're unblocked.

Note that you can also use the parse_jsonb() function in a SQL query to parse a VARCHAR-style column into a JSONB value. For example, with a hard-coded string value:

parse_jsonb('{"a":1, "b":null}')

https://www.labkey.org/Documentation/wiki-page.view?name=labkeysql

Thanks,
Josh

 
kotlenik responded:  2022-01-14 09:40

Thank you Josh,
Cheers