Getting back slashes in the json/request body in Lua script

69 views Asked by At

While writing Lua script for kong plugin, we are observed that in the encoded body saw the back slashes and when we tried to decode getting error.

Please help to remove the backslashes to decode successfull

Below is the snippet we tried

local json =require "cjson"

body=json.encode(response)
util.application_logging():debug("encoded body"..util.dump(body))

//Here getting as below

body{\"mobileno\":\"98765467\",\"pwd\":\"demo123\"}
body =json.decode(body);

//not getting anything

0

There are 0 answers