Lets say I have table called users with jsonb column called attrs with values like this:
{
"uuid5": {
"label": "Email",
"value": "[email protected]"
},
"uuid6": {
"label": "Last Name ",
"value": "Yang"
}
}
Here is a one-liner:
"attrs": { "uuid5": { "label": "Email", "value": "[email protected]" }, "uuid6": { "label": "Last Name ", "value": "Yang" }
As you can see there are uniq keys uuid5, uuid6 and so on.
How to get users with label = 'Email' and value = '[email protected]'?
In postgres docs about json functions there is a function called jsonb_each which returns set of JSON object key/value pairs. But I could not find a way to write a query based on that.