Postgresql Plpgsql Loop Through Json In Typescript Version