[英]how to extract nested json using sqlite json-extract
如何使用 sqlite json-extract 或其他 sqlite json 命令提取嵌套的 json?
在這里我想提取given_id
"invoices": [{
........
"items": [{
"given_id": "TBC0003B",
...
}
]
}
]
謝謝。
在 SQLite 中,您可以使用json_extract()
如下:
select json_extract(my_json_col, '$.invoices[0].items[0].given_id') my_given_id from mytable
這使您given_id
中的第一個元素的屬性items
數組的第一個元素下invoices
陣列。
with mytable as (select '{
"invoices": [{
"items": [{ "given_id": "TBC0003B" }]
}]
}' my_json_col)
select json_extract(my_json_col, '$.invoices[0].items[0].given_id') my_given_id from mytable
| my_given_id | | :---------- | | TBC0003B |
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.