Parse string to JSON object

<script type="text/javascript">
    var s = '{ "a": 1, "b": 2 }';
    var obj = new Function("return " + s)();
    alert(obj.a);
</script>

 

posted on 2013-07-13 00:30  shcity  阅读(238)  评论(0编辑  收藏  举报

导航