Rearrange JSON file (#868)

This commit is contained in:
Xavier Guimard 2017-02-02 06:33:34 +00:00
parent 5e5cc3f186
commit 5b96200ed6
2 changed files with 5 additions and 4 deletions

View File

@ -285,7 +285,11 @@ sub newNotification {
) . ">$json->{xml}</notification></root>";
}
else {
eval { my $tmp = from_json( $json->{xml} ); $json->{xml} = $tmp; };
eval {
my $tmp = from_json( $json->{xml} );
$json->{$_} = $tmp->{$_} foreach ( keys %$tmp );
delete $json->{xml};
};
if ($@) {
$self->lmLog( "Notification malformed $@", 'error' );
return $self->sendError( $req, "Notification malformed: $@", 200 );

View File

@ -209,9 +209,6 @@ sub toForm {
@{ $_->{check} } ];
}
$_->{id} = "1x$i";
foreach my $k ( keys %{ $_->{xml} } ) {
$_{$k} = $_->{xml}->{$k};
}
$_;
} @notifs;
require HTML::Template;