[lua]判断nginx收到的是否json
local post_data = ngx.req.get_body_data()--[[ngx.log(ngx.ERR, 'post data:', post_data)]]local ok, res_tab = pcall(cjson.decode, post_data)if not ok then ngx.log(ngx.ERR, 'post data is not json!', post_data)get_respone(Result_Code.Error)returnend-- 真正判断是否jsonpost_data = string.gsub(post_data,""{","{")post_data = string.gsub(post_data,"}"","}")post_data = string.gsub(post_data,"\","")local ok, res_tab = pcall(cjson.decode, post_data)if not ok then ngx.log(ngx.ERR, 'post data is not json!', post_data)get_respone(Result_Code.Error)returnend