From: Jan-Philipp Litza Date: Sun, 30 Aug 2015 13:45:49 +0000 (+0200) Subject: luci-lib-jsonc: allow encoding empty lists X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fluci.git;a=commitdiff_plain;h=e7645d557c1bd532e49c69f0ab781cf6342067d1;hp=e7645d557c1bd532e49c69f0ab781cf6342067d1 luci-lib-jsonc: allow encoding empty lists To be consistent with the behavior of luci-lib-json, an empty Lua table should be encoded to an empty JSON list, not an empty JSON object. To still allow encoding empty JSON objects, the usage of anything other than a number or a string as a key (for example an empty table or a function) can be used to force encoding as an object: json.stringify({}) -- "[]" json.stringify({[{}] = true}) -- "{}" Signed-off-by: Jan-Philipp Litza ---