json parse string vs eval (v4)

Revision 4 of this benchmark created on


Preparation HTML

<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js">
</script>
<script>
  var jsontext = '{"firstname":"Jesper","surname":"Aaberg","phone":["555-0100","555-0120"]}';
  var errorMsg = null;
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
eval
eval("errorMsg = " + jsontext + ";");
 
ready
json
JSON.parse(jsontext);
 
ready
function constructor
new Function("return " + jsontext)();
 
ready
jquery
jQuery.parseJSON(jsontext);
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.