Postgresql Iterate Over Json Array Length Python Array