I am using array_to_json in combination with array_agg to format certain results in PostgreSQL as JSON. This works fine for queries in which I want to return the default value of a query (all columns, unmodified). But I'm stumped on how I could use array_agg to create a JSON object for a query in which I want to modify some of the output. I am using array_to_json in combination with ar