Commit 1b43a464 authored by Rob Jonson's avatar Rob Jonson Committed by Jean-Baptiste Kempf

clean up json output

Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent 35cb1ed0
...@@ -196,9 +196,28 @@ function xmlString(s) ...@@ -196,9 +196,28 @@ function xmlString(s)
end end
end end
--dkjson outputs numbered tables as arrays
--so we don't need the array indicators
function removeArrayIndicators(dict)
local newDict=dict
for k,v in pairs(dict) do
if (type(v)=="table") then
local arrayEntry=v._array
if arrayEntry then
v=arrayEntry
end
dict[k]=removeArrayIndicators(v)
end
end
return newDict
end
printTableAsJson = function (dict) printTableAsJson = function (dict)
dict=removeArrayIndicators(dict)
local output=dkjson.encode (dict, { indent = true }) local output=dkjson.encode (dict, { indent = true })
print(output) print(output)
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment