How can I handle uuid and jsob in PGSQL

In my database, I’ve the below structure:

CREATE TABLE public.devices
    id uuid,
    data jsonb

When I run my query using this package, I got the below, how can I read the output properly?

I am not sure how to convert the PostgreSQL-id (uuid) to a UUID-type in Julia, but using the JSON3-library you could do something like this (using my data):

julia> x =[1])
JSON3.Object{Base.CodeUnits{UInt8,String},Array{UInt64,1}} with 1 entry:
  :REC => {…

What is df here?

I think @johann.spies is assuming your data is in a DataFrame. You can get this (probably) by doing:

df = data |> DataFrame

to convert to a DataFrame, and then:

using JSON3; x =[1])

to read the first row’s data field into a JSON3.Object which you can work with.

Thanks @jpsamaroo and @johann.spies, things are OK now

1 Like