-function jsondump(x)
- if x == nil then
- luci.http.write("null")
- elseif type(x) == "table" then
- local k, v
- if type(next(x)) == "number" then
- luci.http.write("[ ")
- for k, v in ipairs(x) do
- jsondump(v)
- if next(x, k) then
- luci.http.write(", ")
- end
- end
- luci.http.write(" ]")
- else
- luci.http.write("{ ")
- for k, v in pairs(x) do
- luci.http.write("%q: " % k)
- jsondump(v)
- if next(x, k) then
- luci.http.write(", ")
- end
- end
- luci.http.write(" }")
- end
- elseif type(x) == "number" or type(x) == "boolean" then
- luci.http.write(tostring(x))
- elseif type(x) == "string" then
- luci.http.write("%q" % tostring(x))
- end
-end
-
-