Merge pull request #402 from NeoRaider/json-empty-object
luci-lib-json: ignore null keys to allow encoding empty objects
This commit is contained in:
commit
edf0f4f549
1 changed files with 7 additions and 5 deletions
|
@ -149,11 +149,13 @@ function Encoder.parse_iter(self, obj)
|
||||||
local first = true
|
local first = true
|
||||||
|
|
||||||
for key, entry in pairs(obj) do
|
for key, entry in pairs(obj) do
|
||||||
first = first or self:put(",")
|
if key ~= null then
|
||||||
first = first and false
|
first = first or self:put(",")
|
||||||
self:parse_string(tostring(key))
|
first = first and false
|
||||||
self:put(":")
|
self:parse_string(tostring(key))
|
||||||
self:dispatch(entry)
|
self:put(":")
|
||||||
|
self:dispatch(entry)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
self:put("}")
|
self:put("}")
|
||||||
|
|
Loading…
Reference in a new issue