mirror of
https://github.com/openwrt/luci.git
synced 2026-08-29 06:22:49 +04:00
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:
@@ -149,11 +149,13 @@ function Encoder.parse_iter(self, obj)
|
||||
local first = true
|
||||
|
||||
for key, entry in pairs(obj) do
|
||||
first = first or self:put(",")
|
||||
first = first and false
|
||||
self:parse_string(tostring(key))
|
||||
self:put(":")
|
||||
self:dispatch(entry)
|
||||
if key ~= null then
|
||||
first = first or self:put(",")
|
||||
first = first and false
|
||||
self:parse_string(tostring(key))
|
||||
self:put(":")
|
||||
self:dispatch(entry)
|
||||
end
|
||||
end
|
||||
|
||||
self:put("}")
|
||||
|
||||
Reference in New Issue
Block a user