简体   繁体   English

Postgres广告嵌套json

[英]Postgres ad nested json

I am trying to parse a field from a nested JSON using postgresql. 我正在尝试使用postgresql从嵌套的JSON解析字段。 The form of a JSON has the following form: JSON的形式具有以下形式:

{"Field_1": {"Field_2": {"Field_3": "value_1": "xxx"}}}

I have read the question How do I query using fields inside the new PostgreSQL JSON datatype? 我已经阅读了问题如何使用新的PostgreSQL JSON数据类型内的字段进行查询? and I have searched the proposed links, but I have not found anything to work. 并且我已经搜索了建议的链接,但没有找到任何有效的方法。

{"Field_1": {"Field_2": {"Field_3": "value_1": "xxx"}}}

I want to parse the xxx of value_1 . 我想解析value_1xxx

Your JSON have incorrect syntax, this is correct one: 您的JSON语法错误,这是正确的一种:

{"Field_1": {"Field_2": {"Field_3": {"value_1": "xxx"}}}}

Then you can: 那么你也能:

select j->'Field_1'->'Field_2'->'Field_3'->'value_1' from (
    select '{"Field_1": {"Field_2": {"Field_3": {"value_1": "xxx"}}}}'::jsonb as j
) t

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM