diff --git a/src/output/json.lua b/src/output/json.lua index c87a29e..3a1bba1 100644 --- a/src/output/json.lua +++ b/src/output/json.lua @@ -3,22 +3,7 @@ local json = config.json return { handler = function(context) context.response.headers["content-type"] = "application/json" - - local output = context.output - local meta = getmetatable(output) - - if meta and type(meta.__toView) == "function" then - output = meta.__toView(output, context) - end - - local raw - if config.encodeEmptyTableAsArray and next(output) == nil then - raw = "[]" - else - raw = json.encode(output) - end - - context.response.send(raw) + context.response.send(json.encode(context.output)) end, options = {