Skip to content
Snippets Groups Projects
Select Git revision
  • 34e8aed9f82f511063cb22951a3b6193982df45e
  • v2018.2.x default
  • experimental
  • master
  • v2021.1.2-ffs
  • v2021.1.1-ffs
  • nrb/gluon-master-cpe510
  • v2021.1-ffs
  • v2020.2.3-ffs
  • nrbffs/fastd-remove-delay
  • v2020.2.2-ffs
  • v2020.2.1-ffs
  • v2020.2-ffs
  • v2020.2.x
  • v2020.1.3-ffs
  • v2020.1.1-ffs
  • v2020.1-ffs
  • v2019.1.2-ffs
  • v2019.1.1-ffs
  • nrb/test-radv-filter
  • v2019.1-ffs
  • nrbffs/netgear-ex6120
  • v2021.1.2-ffs0.2
  • v2021.1.2-ffs0.1
  • v2021.1.1-ffs0.4
  • v2021.1.1-ffs0.3
  • v2021.1.1-ffs0.2
  • v2021.1.1-ffs0.1
  • v2021.1-ffs0.1
  • v2020.2.3-ffs0.3
  • v2020.2.3-ffs0.2
  • v2020.2.3-ffs0.1
  • v2020.2.2-ffs0.1
  • v2020.2.1-ffs0.1
  • v2020.2-ffs0.1
  • v2020.2
  • v2020.2.x-ffs0.1
  • v2020.1.3-ffs0.1
  • v2020.1.1-ffs0.1
  • v2020.1-ffs0.1
  • v2019.1.2-ffs0.1
  • v2019.1.1-ffs0.1
42 results

generate-actions.py

Blame
  • Forked from firmware / FFS Gluon
    Source project has a limited visibility.
    0004-luci-lib-json-ignore-null-keys-to-allow-encoding-empty-objects.patch 1.17 KiB
    From: Matthias Schiffer <mschiffer@universe-factory.net>
    Date: Thu, 4 Jun 2015 21:03:24 +0200
    Subject: luci-lib-json: ignore null keys to allow encoding empty objects
    
    There is currently no way to encode an empty object {}, as empty tables are
    encoded as empty lists [].
    
    With this patch, encode() will ignore table fields with the key json.null (which
    doesn't make sense anyways). This allows adding a field with key json.null to
    force encoding it as an object.
    
    Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
    
    diff --git a/libs/luci-lib-json/luasrc/json.lua b/libs/luci-lib-json/luasrc/json.lua
    index 416b25f..f7b57f9 100644
    --- a/libs/luci-lib-json/luasrc/json.lua
    +++ b/libs/luci-lib-json/luasrc/json.lua
    @@ -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("}")