Postgresql – Dynamically build json with json_build_object
I am using json_build_object to build a json object using other columns: json_build_object(value1, qty1, value2, qty2, value3, qty3) Every pair (value, qty) go together. I only want the json object to contain the pairs that don't have an empty value.…