Loading ...
Sorry, an error occurred while loading the content.

Re: [json] Re: Iterating through a huge JSON variable - freezes FF

Expand Messages
  • Michal Migurski
    ... Yuck, file a bug report. There s no excuse for generating javascript and calling it JSON. ... Maybe, though it depends on how long it takes to parse the
    Message 1 of 10 , Feb 8, 2007
    • 0 Attachment
      > > Nitpick: this isn't valid JSON, get those hash keys quoted.
      > It was generated with the JSON addin to RoR. Will look into that
      > later on.

      Yuck, file a bug report. There's no excuse for generating javascript
      and calling it JSON.


      > I try to avoid the trip back to the server and download the list just
      > once. Could it be better to do the following:
      >
      > 1. Download the entire JSON
      > 2. Iterate through the first 100 and break
      > 3. back to step 2 until the entire JSON has been iterated

      Maybe, though it depends on how long it takes to parse the entire
      message - there's an upper limit of reasonability to this, too. You
      don't want to download a 10,000 item array and parse that in one go,
      or discover the array that presents no problems on your browser but
      brings an older or slower computer to its knees.

      I wrote a quick blog post specifically about chunking this kind of
      task out, with some tiny example code:
      http://mike.teczno.com/notes/polite-loops.html

      -mike.

      ----------------------------------------------------------------
      michal migurski- contact info and pgp key:
      sf/ca http://mike.teczno.com/contact.html
    • carl.harroch
      Thanks Mike, I beleive I will go for your last solution. Currently I am working on several part of my site which does not permit a lot of time on the iterating
      Message 2 of 10 , Feb 15, 2007
      • 0 Attachment
        Thanks Mike,

        I beleive I will go for your last solution. Currently I am working on
        several part of my site which does not permit a lot of time on the
        iterating part. As soon as I manage to test some different setup on
        different, I will post back a summary of my founding.

        I keep you updated,
        Carl

        --- In json@yahoogroups.com, Michal Migurski <mike-jsonphp@...> wrote:
        >
        > > > Nitpick: this isn't valid JSON, get those hash keys quoted.
        > > It was generated with the JSON addin to RoR. Will look into that
        > > later on.
        >
        > Yuck, file a bug report. There's no excuse for generating javascript
        > and calling it JSON.
        >
        >
        > > I try to avoid the trip back to the server and download the list just
        > > once. Could it be better to do the following:
        > >
        > > 1. Download the entire JSON
        > > 2. Iterate through the first 100 and break
        > > 3. back to step 2 until the entire JSON has been iterated
        >
        > Maybe, though it depends on how long it takes to parse the entire
        > message - there's an upper limit of reasonability to this, too. You
        > don't want to download a 10,000 item array and parse that in one go,
        > or discover the array that presents no problems on your browser but
        > brings an older or slower computer to its knees.
        >
        > I wrote a quick blog post specifically about chunking this kind of
        > task out, with some tiny example code:
        > http://mike.teczno.com/notes/polite-loops.html
        >
        > -mike.
        >
        > ----------------------------------------------------------------
        > michal migurski- contact info and pgp key:
        > sf/ca http://mike.teczno.com/contact.html
        >
      Your message has been successfully submitted and would be delivered to recipients shortly.