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.

1 Answer 1

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
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.