Design: Postgres, Parent to Child / Child to Parent / Child to Child | JSONB
First, as always a_horse_with_no_name is right. Read this

As to how you can factor out your jsonb. You can use a single-table hierarchy.

CREATE TABLE items (
  item_id    serial  PRIMARY KEY
  parent_id  int     REFERENCES items,
  details    jsonb
);


At the very least with this scheme you've removed out the IDS. Now you just use a recursive query to query the data.

For more information look up 


an example with id/parentid/query
[hierarchy] + [postgresql]