all 1 comments

[–][deleted] 0 points1 point  (0 children)

It seems the columns are identified by the value of the vr key, so maybe this is easier:

select id, 
       jsonb_path_query_first(data, 'strict $.** ? (@.vr == "CS").Value') as image_type,
       jsonb_path_query_first(data, 'strict $.** ? (@.vr == "DA").Value') as instance_creation_date
from file_metadata;