JSON使用JavaScript编码/解码base64编码/解码

JSON使用JavaScript编码/解码base64编码/解码

问题描述:

JavaScript中是否有JSON编码/解码base64编码/解码功能?

Is there JSON encode/decode base64 encode/decode function in JavaScript?

是,btoa()和atob( )在某些浏览器中工作:

Yes, btoa() and atob() work in some browsers:

var enc = btoa("this is some text");
alert(enc);
alert(atob(enc));