<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>JqueryDemo1</title>
<script src="jquery.js"></script>
<script>

function showData() {
    var str='{ "name": "John" }';//json标准格式
    var obj = eval('(' + str + ')'); 
    alert( obj.name);

    var str2="{ 'name': 'John' }";
    var obj2 = eval('(' + str2 + ')'); 
    alert( obj2.name);

    var str3='{"GetUserPostByIdResult":{"Age":"33","ID":"2server","Name":"mady"}}';
    var obj3 = eval('(' + str3 + ')'); 
    alert( obj3.GetUserPostByIdResult.ID);
    
    var data=" { root: [ {'name':'6200','value':'0'}, {'name':'6101','value':'xa'}, {'name':'6102','value':'beijing'}, {'name':'6103','value':'haerbin'}]}";
    var date1=eval('('+data+')');
    alert(date1.root[2].name);

  var last=JSON.stringify(obj);//将JSON对象转化为JSON字符
    alert(last);
}


</script>
</head>
<body>
<input id="Button1" type="button" value="Hit Me" οnclick="showData()" /> 

</body>
</html>