Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fastest way to iterate through JSON string in Javascript

I have been using $.each of the jQuery framework to iterate through a JSON string that I receive via an AJAX call. Now this string is sometimes quite huge and as a result IE6/7/8 crawl as a result.

I am wondering if there is a faster way to iterate through the entire data.

Thank you for your time.

like image 340
Alec Smart Avatar asked Jun 26 '09 18:06

Alec Smart


1 Answers

How about using the regular javascript functions?

If for example you have a JSON object with items in them, you could just eval the JSON string to convert it to javascript objects, and iterate over them using 'for (i in object)'.

like image 164
ylebre Avatar answered Nov 03 '22 14:11

ylebre