+ while (my ($col, $val) = each %{$row}) {
+ # convert json subcolumns to database string
+ ref $val eq 'HASH' or next;
+ $val = { %{$_}, %{$val} } for $replace->{$col} // (); # preserve unknown
+ defined $val->{$_} or delete $val->{$_} for keys %{$val}; # delete emptied
+ $row->{$col} = encode_json($val);
+ }