Answer the question
In order to leave comments, you need to log in
PostgreSQL search in json array?
The table is like this:
id, comp
comp is json:
[
{
"character": "俄",
"components": [
"亻",
"手",
"戈"
]
},
{
"character": "罗",
"components": [
"罒",
"夕"
]
},
{
"character": "斯",
"components": [
"甘",
"一",
"八",
"斤"
]
}
]
Answer the question
In order to leave comments, you need to log in
SELECT * FROM some_table WHERE comp @> '{"components": ["夕"]}'
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question