I have the following table structure:
create table system_log
(
id bigserial primary key,
details jsonb
);
Data in ‘details’ column is json with inner json:
{
"prop1": "value1",
"prop2": "value2",
"body": "{"prop3": "value3"}"
}
How to select data from inner json like ‘select details.body.prop3 …’ ?
3
Answers
You can use the arrow operators:
->
retrieves the result asjsonb
,->>
retrieves the result astext
.Having
You could query like this
Or also use a condition
Working sample here
and the docs