jQuery.parseJSON and JSON.parse are two functions that perform the same task. If the jQuery library is already loaded, would using jQuery.parseJSON be better than using JSON.parse, in terms of performance?
If yes, why? If no, why not?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Here is an extract from jQuery 1.9.1:
As you can see, jQuery will use the native
JSON.parsemethod if it is available, and otherwise it will try to evaluate the data withnew Function, which is kind of likeeval.So yes, you should definitely use
jQuery.parseJSON.