How get JSONB Columns as json object?

Hi, everybody. I have a table that some columns that are JSONB,

  nk.sqlExec(
    'CREATE TABLE IF NOT EXISTS z_test (' +
    'id UUID NOT NULL DEFAULT gen_random_uuid(), ' +
    'stats JSONB,' +
    'stats_list JSONB,' +
    'CONSTRAINT "primary" PRIMARY KEY (id ASC))'
    , parameters)

that JSONB columns contain these data:

stats :

{"h": 10, "m": 20, "s": 110, "sp": 200}

stats_list :

[{"h": 10, "m": 20, "s": 110, "sp": 200},{"h": 10, "m": 20, "s": 110, "sp": 200}]

but in the query result these JSONB columns are as typeof byte array.

SELECT * FROM test WHERE id = 'd32242f0-233d-4f3f-a05b-f04c2bd0196a';

I try some jsonb cocrochdb functions like jsonb_pretty but this function return data as string and other limitation is manual query for all jsonb columns and can not use ‘select * from’

SELECT jsonb_pretty(stats) as stats,jsonb_pretty(stats_list) as stats_list FROM test WHERE id = 'd32242f0-233d-4f3f-a05b-f04c2bd0196a';

Hi @EbiPenMan, are you running a custom RPC to dynamically query your table?

If so, you might need to handle your jsonb fields directly in the RPC, like converting it to a string from a byte array before returning it.