2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-10 09:16:53 +00:00

fhem.pl/10_MQTT2_DEVICE.pm: fix json detection (Forum #104956)

git-svn-id: https://svn.fhem.de/fhem/trunk@20460 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2019-11-05 19:06:03 +00:00
parent a45cc2cc17
commit f7cb4789a2
2 changed files with 2 additions and 2 deletions

View File

@ -215,7 +215,7 @@ MQTT2_DEVICE_Parse($$)
my $cidArr = $modules{MQTT2_DEVICE}{defptr}{cid}{$newCid}; my $cidArr = $modules{MQTT2_DEVICE}{defptr}{cid}{$newCid};
return if(!$cidArr); return if(!$cidArr);
my $add; my $add;
if(length($value) < 10000 && $value =~ m/^{.*}$/s) { if(length($value) < 10000 && $value =~ m/^\s*{.*}\s*$/s) {
my $ret = json2nameValue($value); my $ret = json2nameValue($value);
if(keys %{$ret}) { if(keys %{$ret}) {
$topic =~ m,.*/([^/]+),; $topic =~ m,.*/([^/]+),;

View File

@ -5203,7 +5203,7 @@ json2nameValue($;$$)
return (undef, $in); return (undef, $in);
} }
$in = $1 if($in =~ m/^{(.*)}$/s); $in = $1 if($in =~ m/^\s*{(.*)}\s*$/s);
my $err; my $err;
while($in =~ m/^\s*"([^"]+)"\s*:\s*(.*)$/s) { while($in =~ m/^\s*"([^"]+)"\s*:\s*(.*)$/s) {