0
Node.js/Javascript를 사용하여 객체를 문자열로 변환하는 중 다음 오류가 발생합니다.Node.js를 사용하여 객체를 문자열로 변환하는 중에 유형 오류가 발생합니다.
TypeError: Converting circular structure to JSON
at Object.stringify (native)
at exports.userlogin (/opt/lampp/htdocs/FGDP/route/route.js:11:19)
at Layer.handle [as handle_request] (/opt/lampp/htdocs/FGDP/node_modules/express/lib/router/layer.js:95:5)
at next (/opt/lampp/htdocs/FGDP/node_modules/express/lib/router/route.js:131:13)
at Route.dispatch (/opt/lampp/htdocs/FGDP/node_modules/express/lib/router/route.js:112:3)
at Layer.handle [as handle_request] (/opt/lampp/htdocs/FGDP/node_modules/express/lib/router/layer.js:95:5)
at /opt/lampp/htdocs/FGDP/node_modules/express/lib/router/index.js:277:22
at Function.process_params (/opt/lampp/htdocs/FGDP/node_modules/express/lib/router/index.js:330:12)
at next (/opt/lampp/htdocs/FGDP/node_modules/express/lib/router/index.js:271:10)
아래 코드를 설명하고 있습니다.
exports.userlogin=function(req,res){
var username=req.body.user_name;
var password=req.body.user_pass;
var ciphertext = CryptoJS.AES.encrypt(password, 'lexelPass');
var pass=JSON.stringify(ciphertext);
}
여기에 내가 데이터 형식 개체입니다 ciphertext
변수를 얻고있다 그리고 난 그것이 문자열로 변환해야합니다. 하지만 여기에 내가 이런 종류의 오류가 발생했습니다. 이 문제를 해결하도록 도와주세요.
당신은 콘솔과'ciphertext'의 반환 형식을 봤어? 어떤 유형입니까? – ricky
여기'ciphertext'는 객체가 아니라'word-array' 또는'byte-array' 중 하나라고 생각합니다. 먼저 객체에 필요한 변환 작업을 수행하십시오. – nashcheez
@ricky : 그것의 유형을주는'객체'. – satya