Postgresql Row To Json Object In Array Javascript Methods For Querying