vlc | branch: master | Rob Jonson <[email protected]> | Wed Sep 28 13:05:16 2011 +0100| [1b43a4641d0272102153d13e4d8ced5d1a0a80ce] | committer: Jean-Baptiste Kempf
clean up json output Signed-off-by: Jean-Baptiste Kempf <[email protected]> > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=1b43a4641d0272102153d13e4d8ced5d1a0a80ce --- share/lua/intf/modules/httprequests.lua | 19 +++++++++++++++++++ 1 files changed, 19 insertions(+), 0 deletions(-) diff --git a/share/lua/intf/modules/httprequests.lua b/share/lua/intf/modules/httprequests.lua index 9e549c4..bbef569 100644 --- a/share/lua/intf/modules/httprequests.lua +++ b/share/lua/intf/modules/httprequests.lua @@ -196,9 +196,28 @@ function xmlString(s) 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) + dict=removeArrayIndicators(dict) + local output=dkjson.encode (dict, { indent = true }) print(output) end _______________________________________________ vlc-commits mailing list [email protected] http://mailman.videolan.org/listinfo/vlc-commits
