In case it saves anyone a headache: Pivoting with Postgres’ JSON features (json_build_object and json_object_agg, specifically) is usually less difficult than crosstab IME.
I’ve used it for exactly this same sorta metadata logging.
I’ve used it for exactly this same sorta metadata logging.