我有以下jQuery/JS代码
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
<script>
$.getJSON("http://example/topics", {}, function(data){
console.log( data ); // display the JSON *data* in the web console
console.log( $.parseJSON(data) );
});
</script>
Run Code Online (Sandbox Code Playgroud)
console.log(data)显示firebug控制台(firefox附加组件)中的JSON数据,但console.log($ .parseJSON(data))显示为null.
可能的原因是什么.
我需要将JSON字符串转换为数组.