Đây là một trích xuất từ jQuery 1.9.1 :
parseJSON: function( data ) {
if ( window.JSON && window.JSON.parse ) {
return window.JSON.parse( data );
}
if ( data === null ) {
return data;
}
if ( typeof data === "string" ) {
data = jQuery.trim( data );
if ( data ) {
if ( rvalidchars.test( data.replace( rvalidescape, "@" )
.replace( rvalidtokens, "]" )
.replace( rvalidbraces, "")) ) {
return ( new Function( "return " + data ) )();
}
}
}
jQuery.error( "Invalid JSON: " + data );
},
Như bạn có thể thấy, jQuery sẽ sử dụng JSON.parsephương thức gốc nếu nó có sẵn, và nếu không, nó sẽ cố gắng đánh giá dữ liệu new Function, tương tự như vậy eval.
Vì vậy, có, bạn chắc chắn nên sử dụng jQuery.parseJSON.