diff options
-rw-r--r-- | libs/luci-lib-json/luasrc/json.lua | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/libs/luci-lib-json/luasrc/json.lua b/libs/luci-lib-json/luasrc/json.lua index f7b57f916c..6d4d752b19 100644 --- a/libs/luci-lib-json/luasrc/json.lua +++ b/libs/luci-lib-json/luasrc/json.lua @@ -181,13 +181,18 @@ function Encoder.parse_iter(self, obj) end end +function Encoder.parse_udata(self, obj) + return self:parse_string(tostring(obj)) +end + Encoder.parsers = { ['nil'] = Encoder.parse_nil, ['table'] = Encoder.parse_iter, ['number'] = Encoder.parse_number, ['string'] = Encoder.parse_string, ['boolean'] = Encoder.parse_bool, - ['function'] = Encoder.parse_iter + ['function'] = Encoder.parse_iter, + ['userdata'] = Encoder.parse_udata, } |