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

Re: json keys

Expand Messages
  • Mark Ireland
    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
    Message 1 of 15 , Jun 28, 2007
      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.
      >
      >

      _________________________________________________________________
      Advertisement: ninemsn Travel - Hot deals, travel ideas & Lonely Planet
      guides.
      http://ninemsn.com.au/share/redir/adTrack.asp?mode=click&clientID=799&referral=hotmailtagline&URL=http://travel.ninemsn.com.au/compIntro.aspx?compId=2404
    • 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 2 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.