我有一个字符串,我想解码成json。字符串最初是基底64。我试着解码成Jason,我得到了以下错误。
var query_string = new Buffer(bid, base64 ).toString( ascii );
console.log(query_string);
var q = JSON.parse(query_string);
{ avid : [email protected] , crid : 20767073515 , mabid : { node : None, hod : 13 , cid : 36 , industry : None, ex : 1 , vid1 : 29 , dow : 3 }, prid : { hod : 13 , woy : 18 , cid : 36 , dow : 3 , ssp : adx , st : None, bt : firefox , cty : tokyo , ex : 1 , vid2 : 222 , dt : 1 , os : mac , vid1 : 29 }, agid : 4547917795 , cookieid : retageting:cookie , did : yahoo.com , validation : True}
SyntaxError: Unexpected token at Object.parse (native) at /home/ubuntu/workspace/rtbopsConfig/rtbServers/rtbNodejsServer/app.js:115:16 at callbacks (/home/ubuntu/workspace/rtbopsConfig/rtbServers/rtbNodejsServer/node_modules/express/lib/router/index.js:272:11) at param (/home/ubuntu/workspace/rtbopsConfig/rtbServers/rtbNodejsServer/node_modules/express/lib/router/index.js:246:11) at pass (/home/ubuntu/workspace/rtbopsConfig/rtbServers/rtbNodejsServer/node_modules/express/lib/router/index.js:253:5) at Router._dispatch (/home/ubuntu/workspace/rtbopsConfig/rtbServers/rtbNodejsServer/node_modules/express/lib/router/index.js:280:4) at Object.handle (/home/ubuntu/workspace/rtbopsConfig/rtbServers/rtbNodejsServer/node_modules/express/lib/router/index.js:45:10) at next (/home/ubuntu/workspace/rtbopsConfig/rtbServers/rtbNodejsServer/node_modules/express/node_modules/connect/lib/http.js:204:15) at Object.methodOverride [as handle] (/home/ubuntu/workspace/rtbopsConfig/rtbServers/rtbNodejsServer/node_modules/express/node_modules/connect/lib/middleware/methodOverride.js:35:5) at next (/home/ubuntu/workspace/rtbopsConfig/rtbServers/rtbNodejsServer/node_modules/express/node_modules/connect/lib/http.js:204:15)