diff options
Diffstat (limited to 'Master/tlpkg')
-rw-r--r-- | Master/tlpkg/TeXLive/TLPOBJ.pm | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/Master/tlpkg/TeXLive/TLPOBJ.pm b/Master/tlpkg/TeXLive/TLPOBJ.pm index 9e91daa25ad..77f2290e442 100644 --- a/Master/tlpkg/TeXLive/TLPOBJ.pm +++ b/Master/tlpkg/TeXLive/TLPOBJ.pm @@ -425,6 +425,22 @@ sub as_json { require JSON; #my $json = JSON::PP->new->utf8; my %foo = %{$self}; + # make sure numbers are encoded as numbers + for my $k (qw/revision runsize docsize srcsize containersize + srccontainersize doccontainersize runcontainersize/) { + $foo{$k} += 0 if exists($foo{$k}); + } + for my $k (keys %{$foo{'binsize'}}) { + $foo{'binsize'}{$k} += 0; + } + # encode boolean as boolean flags + if (exists($foo{'relocated'})) { + if ($foo{'relocated'}) { + $foo{'relocated'} = $JSON::true; + } else { + $foo{'relocated'} = $JSON::false; + } + } my $utf8_encoded_json_text = JSON::encode_json(\%foo); # $json->encode(\%foo); return $utf8_encoded_json_text; } |