Javascript 字符串转JSon数组

<script type="text/javascript">

var chgStringToObject = function(){

var str = '[ {"green":10,"size":5,"strock":12},{"green":10,"size":2,"strock":20} ]';

var json = eval(str);

alert(json[1].green);

};

</script>

相关推荐