my @val = map { parseinput($_) } $post{'@'.$col}->@*;
my $val = $colinfo->{-multiple} && @val ? \@val : $val[-1];
if (my $jsoncol = $colinfo->{-json}) {
- defined $val and
$row->{$jsoncol}->{$col} = $val; # hash will be encoded
}
else {
}
}
my $imagecol = $row->{image}; # backup image subcolumns
- ref $_ eq 'HASH' and $_ = encode_json($_) for values %{$row};
+ while (my ($col, $val) = each %{$row}) {
+ # convert json subcolumns to database string
+ ref $val eq 'HASH' or next;
+ $val = { %{decode_json($_)}, %{$val} } for $replace->{$col} // (); # preserve unknown
+ defined $val->{$_} or delete $val->{$_} for keys %{$val}; # delete emptied
+ $row->{$col} = encode_json($val);
+ }
if (!$row->{form} and $row->{lang}) {
if ($row->{ref} ne 'delete') {