0

I am trying to parse a field from a nested JSON using postgresql. The form of a JSON has the following form:

{"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? 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.

Evi
  • 11
  • 1
  • 3

1 Answers1

1

Your JSON have incorrect syntax, this is correct one:

{"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
Oto Shavadze
  • 40,603
  • 55
  • 152
  • 236