There is no need to do that. Should not do that if you have arbitrary values in your database. Just create another table with all the keys and values aligned like that:
id | other_pk | key | value
This of cause would require another query to the database and you might have to iterate through all retrieved rows in your code to build the hash table manually (although your JSON library will do the same).
Im not saying that you should not use JSONB for that (I probably would too for that example), Im just saying there are more ways to design your data storages.