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) return end -- 真正判断是否json post_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) return end