summaryrefslogtreecommitdiffhomepage
path: root/libs/luci-lib-jsonc
AgeCommit message (Collapse)Author
2015-08-31luci-lib-jsonc: Fix memory leak in stringify()Jan-Philipp Litza
2015-08-30luci-lib-jsonc: allow encoding empty listsJan-Philipp Litza
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 <janphilipp@litza.de>
2015-08-30luci-lib-jsonc: Ignore non-string-or-number keys in tablesJan-Philipp Litza
Previously, the following caused a segmentation fault: json.stringify({[{}] = true}) This was caused by lua_tostring() returning NULL for anything but strings and numbers, letting json_object_object_add crash. This patch makes jsonc ignore all keys which have no string representation altogether. Signed-off-by: Jan-Philipp Litza <janphilipp@litza.de>
2015-01-28luci-lib-jsonc: add api documentationJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2015-01-26libs: add luci-lib-jsonc, a Lua binding for JSON-CJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>