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

Re: json keys

Expand Messages
  • marcrbraincast
    Okay, fair enough... it will get smaller... You could indeed loose the list of columns and even the UNIQUEIDS and the totalItems... Not sure what the
    Message 1 of 15 , Jun 29, 2007
      Okay, fair enough... it will get smaller...
      You could indeed loose the list of columns and even the UNIQUEIDS and
      the totalItems...

      Not sure what the itemsFound does...


      var j = {"itemsFound":2,
      "items":[
      {"js63013":["A1 Services","CEO","Jane
      Jones","800-555-2121","janejones@..."]},
      {"js63009":[" Acme","President","John
      Smith","800-555-1212","johnsmith@acme. com"]}
      ]
      };
      window.onload = function(){
      var txt = "";
      var col = j.items;
      var totalitems = j.items.length;
      for (var i=0;i<totalitems;i++){
      for (j in col[i]){
      txt += col[i][j] + " \n";
      }

      }
      alert(totalitems + "\n" + txt);
      }







      --- In json@yahoogroups.com, "Mark Ireland" <markincuba@...> wrote:
      >
      >
      > Somewhat smaller? I was thinking a large object would be shrunk by half
      > because there would be no repetition of the columnnames everywhere.
      . ...
      >
      > And I thought my idea would make getting a value as easy as
      >
      > myJSON["js63009"].Company
      >
      > I suppose the list of columnnames could be an array since people would
      > propbably make it into one so they can loop over it?
      >
      > >Then it would probably become something like this:
      > >
      >
      >{"totalItems":40,"itemsFound":2,"UNIQUEIDS":["js63013","js63009"],"columnnames":["Company","Title","Name","Phone","Email"],"items":{"js63013":["A1
      > >Services","CEO","Jane Jones","800-555-2121","janejones@a1service
      > >s.com"],"js63009":[" Acme","President","John
      > >Smith","800-555-1212","johnsmith@acme. com"]}}
      > >
      > >But although that probably results in a somewhat smaller json string I
      > >don't really see a benefit, in fact, the object looks a lot more
      > >difficult to get the value's form.
      > >
      > >
      >
    Your message has been successfully submitted and would be delivered to recipients shortly.