2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 06:39:11 +00:00

99_valetudoUtils.pm:Forum topic=121017.msg1297370

git-svn-id: https://svn.fhem.de/fhem/trunk@28332 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
Otto123 2024-01-02 13:14:15 +00:00
parent 01ca5472af
commit 5211945985

View File

@ -26,7 +26,8 @@ sub decode_j {
use JSON qw(decode_json);
my $maybe_json = shift;
my $data;
if ( eval { $data = decode_json($maybe_json); 1 } ) { return $data }
# from message https://forum.fhem.de/index.php?msg=1297370
if ( eval { $data = JSON->new->utf8->decode(encode('UTF-8', $maybe_json)); 1 } ) { return $data }
Log3(undef, 1, "JSON decoding error, >$maybe_json< seems not to be valid JSON data: $@");
return q{}
}