store a json object in ArrayBuffer
<p>Want to store a json object in <code>ArrayBuffer</code></p>

<pre><code>function stringToUint(string) {
    var string = btoa(unescape(encodeURIComponent(string))),
        charList = string.split(''),
        uintArray = [];
    for (var i = 0; i &lt; charList.length; i++) {
        uintArray.push(charList[i].charCodeAt(0));
    }
    return new Uint8Array(uintArray);
}

function uintToString(uintArray) {
    var encodedString = String.fromCharCode.apply(null, uintArray),
        decodedString = decodeURIComponent(escape(atob(encodedString)));
    return decodedString;
}
var str = {'x':'aaaa'},
    enc = stringToUint(str),
    dec = uintToString(enc);

console.log(dec.x);
</code></pre>

<p><code>console.log(dec.x);</code> is printing `undefined. Am I doing it wrongly ?
here is jsfiddle <a href="http://jsfiddle.net/DQJyX/137/" rel="noreferrer">http://jsfiddle.net/DQJyX/137/</a></p>