I
I
Ilya2020-09-02 18:41:08
PostgreSQL
Ilya, 2020-09-02 18:41:08

How to parse any jsonb field in postgresql dynamically?

It is very easy to parse with -> and ->> operators, but it is necessary to manually register each field, but is it possible to write a universal parser that will not depend on the json structure? To be more precise, I'm sure that it is possible with some effort, but I think such a bicycle should already be invented)

I.e. at the input we have a table in which there is a jsonb field with json of any structure, and at the output we get a table in which there are as many fields (columns) as there are key-value pairs in this json . Accordingly, the name of the field will be the name of the key , and the value in this field will be the value .

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question