mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-04-17 17:36:01 +00:00
98_JsonList2.pm: fix problem with filter (Forum #45328)
git-svn-id: https://svn.fhem.de/fhem/trunk@13320 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
9fa9fe74ce
commit
6eba6fc509
@ -34,16 +34,13 @@ JsonList2_Escape($)
|
||||
sub
|
||||
JsonList2_dumpHash($$$$$$)
|
||||
{
|
||||
my ($arrp, $name, $h, $isReading, $si, $attr) = @_;
|
||||
my ($arrp, $name, $h, $isReading, $showInternal, $attr) = @_;
|
||||
my $ret = "";
|
||||
my %filter;
|
||||
@filter{ @$attr } = (undef) x @$attr if @$attr;
|
||||
my %filter = map { $_=>1 } @$attr if(@$attr);
|
||||
|
||||
my @arr = grep { $si || $_ !~ m/^\./
|
||||
and $isReading || !ref($h->{$_})
|
||||
and !%filter || exists $filter{$_}
|
||||
} sort keys %{$h};
|
||||
|
||||
my @arr = grep { ($showInternal || $_ !~ m/^\./) &&
|
||||
($isReading || !ref($h->{$_}) ) &&
|
||||
(!@$attr || $filter{$_}) } sort keys %{$h};
|
||||
for(my $i2=0; $i2 < @arr; $i2++) {
|
||||
my $k = $arr[$i2];
|
||||
$ret .= " \"".JsonList2_Escape($k)."\": ";
|
||||
@ -59,7 +56,7 @@ JsonList2_dumpHash($$$$$$)
|
||||
if(@arr > 1) {
|
||||
push @{$arrp}, " \"$name\": {\n$ret }";
|
||||
} else {
|
||||
push @{$arrp}, " \"$name\": { }";
|
||||
push @{$arrp}, " \"$name\": {$ret }";
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user