mirror of
https://github.com/ntop/ntopng.git
synced 2026-04-30 16:09:32 +00:00
Return a standard json format for arrays
This commit is contained in:
parent
da44b8fb65
commit
6eec119083
8 changed files with 32 additions and 13 deletions
|
|
@ -85,12 +85,11 @@ if counters == nil then
|
|||
return
|
||||
end
|
||||
|
||||
res.data = {}
|
||||
for day=1,days do
|
||||
local day_epoch = epoch_begin + ((day-1) * day_secs)
|
||||
res.data[day_epoch] = {}
|
||||
res[day_epoch] = {}
|
||||
for hour=1,24 do
|
||||
res.data[day_epoch][hour] = 0
|
||||
res[day_epoch][hour] = 0
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -99,7 +98,7 @@ local curr_epoch = epoch_begin
|
|||
for k,v in ipairs(counters) do
|
||||
local day_epoch = v.hour - (v.hour % day_secs)
|
||||
local hour = (v.hour - day_epoch) / hour_secs
|
||||
res.data[day_epoch][hour] = tonumber(v.count)
|
||||
res[day_epoch][hour] = tonumber(v.count)
|
||||
end -- for
|
||||
|
||||
print(rest_utils.rc(rc, res))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue