mirror of
https://github.com/ntop/ntopng.git
synced 2026-04-30 16:09:32 +00:00
Fixes JSON encoding issues
This commit is contained in:
parent
08b3a5410a
commit
5809e7500a
1 changed files with 4 additions and 2 deletions
|
|
@ -118,9 +118,11 @@ local res = {}
|
|||
if(_GET["iffilter"] == "all") then
|
||||
for _, ifname in pairs(interface.getIfNames()) do
|
||||
local ifid = getInterfaceId(ifname)
|
||||
res[ifid] = dumpInterfaceStats(ifname)
|
||||
-- ifid in the key must be a string or json.encode will think
|
||||
-- its a lua array and will look for integers starting at one
|
||||
res[ifid..""] = dumpInterfaceStats(ifname)
|
||||
end
|
||||
else
|
||||
res = dumpInterfaceStats(ifname)
|
||||
end
|
||||
print(json.encode(res, nil, 1))
|
||||
print(json.encode(res))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue