diff --git a/fhem/contrib/statistics/98_fheminfo2.pm b/fhem/contrib/statistics/98_fheminfo2.pm index 1fda300b1..6c670aa20 100644 --- a/fhem/contrib/statistics/98_fheminfo2.pm +++ b/fhem/contrib/statistics/98_fheminfo2.pm @@ -92,7 +92,8 @@ sub _fi2_Count() { } sub _fi2_Send() { - my $json = _fi2_to_json(\%fhemInfo); +# my $json = _fi2_to_json(\%fhemInfo); + my $json = toJSON(\%fhemInfo); Log3("fheminfo",4,"fheminfo: $json"); @@ -188,22 +189,6 @@ sub _fi2_Div($$) { return (int($p1/$p2), $p1 % $p2); } -sub _fi2_to_json { - my $val = shift; - if (not defined $val) { - return "null"; - } elsif (not ref $val) { - $val =~ s/([\0-\x1f\"\\])/sprintf "\\u%04x", ord $1/eg; - return '"' . $val . '"'; - } elsif (ref $val eq 'ARRAY') { - return '[' . join(',', map _fi2_to_json($_), @$val) . ']'; - } elsif (ref $val eq 'HASH') { - return '{' . join(',', map _fi2_to_json($_) . ":" . _fi2_to_json($val->{$_}), sort keys %$val) . '}'; - } else { - return "Cannot encode $val as JSON!\n"; - } -} - 1; =pod