I have following jQuery/JS code
<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>
console.log(data) shows JSON data within firebug console (firefox add-on), but console.log( $.parseJSON(data) ) shows null.
what could be possible reason.
I need to convert JSON string into array.
I assume because
$.getJSONalready parsed the data.datais Javascript object.Of course we could say more if you show us the output, but normally,
$.getJSONalready parses the response.P.S.: I hope you use a proper URL in your real code.