Postgresql Plpgsql Loop Through Json Javascript Object Notation