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

Why quote keys?

Expand Messages
  • geoffreyk00
    I know I read the reason somewhere, but I can t find it now. Why must keys be quoted?
    Message 1 of 6 , May 29 9:59 AM
    • 0 Attachment
      I know I read the reason somewhere, but I can't find it now.
      Why must keys be quoted?
    • geoffreyk00
      I know I read the reason somewhere, but I can t find it now. Why must keys be quoted?
      Message 2 of 6 , May 29 9:59 AM
      • 0 Attachment
        I know I read the reason somewhere, but I can't find it now.
        Why must keys be quoted?
      • Atif Aziz
        An explanation can be found in message #187: http://groups.yahoo.com/group/json/message/187 Quoting the relevant passage here for convenience... JSON requires
        Message 3 of 6 , May 29 10:07 AM
        • 0 Attachment
          An explanation can be found in message #187:
          http://groups.yahoo.com/group/json/message/187

          Quoting the relevant passage here for convenience...

          "JSON requires that keys be quoted because of an error in the
          ECMAScript spec that disallows the use of unquoted reserved words as
          keys. The list of reserved words is surprisingly long and difficult to
          remember. The best practice is to always quote keys."

          -----Original Message-----
          From: json@yahoogroups.com [mailto:json@yahoogroups.com] On Behalf Of
          geoffreyk00
          Sent: Monday, May 29, 2006 6:59 PM
          To: json@yahoogroups.com
          Subject: [json] Why quote keys?

          I know I read the reason somewhere, but I can't find it now.
          Why must keys be quoted?







          Yahoo! Groups Links
        • Pablo Vieira
          Hi, I d like to know if there s any standard procedure to send back a two dimensional array from a PHP server program to a Javascript client program. I want
          Message 4 of 6 , May 29 8:56 PM
          • 0 Attachment
            Hi,

            I'd like to know if there's any "standard" procedure to send back a two
            dimensional array from a PHP server program to a Javascript client program.

            I want to send a table with rows and columns into an array in Javascript.
            Does anyone have any sample code in PHP?

            Thanks

            Pablo
          • Philip Tellis
            ... php: $foo = array( array(1, 2, 3), array(4, 5, 6), array(7, 8, 9)); print json_encode($foo); javascript: var foo = eval( ( + json + ) );
            Message 5 of 6 , May 30 4:15 AM
            • 0 Attachment
              Sometime Today, PV cobbled together some glyphs to say:

              > I'd like to know if there's any "standard" procedure to send back a two
              > dimensional array from a PHP server program to a Javascript client program.

              php:
              $foo = array( array(1, 2, 3), array(4, 5, 6), array(7, 8, 9));
              print json_encode($foo);

              javascript:
              var foo = eval('(' + json + ')');

              alert(foo[0][0]);

              --
              The first time, it's a KLUDGE!
              The second, a trick.
              Later, it's a well-established technique!
              -- Mike Broido, Intermetrics
            • Pablo Vieira
              Oops. Well now all of you know what kind of absolute beginner I am! Thanks Pablo
              Message 6 of 6 , May 30 4:23 AM
              • 0 Attachment
                Oops. Well now all of you know what kind of absolute beginner I am!

                Thanks

                Pablo

                > -----Mensaje original-----
                > De: Philip Tellis [mailto:philip.tellis@...]
                > Enviado el: martes, 30 de mayo de 2006 13:16
                > Para: json@yahoogroups.com
                > Asunto: Re: [json] Two dimensional arrays
                >
                > Sometime Today, PV cobbled together some glyphs to say:
                >
                > > I'd like to know if there's any "standard" procedure to send back a two
                > > dimensional array from a PHP server program to a Javascript client
                > program.
                >
                > php:
                > $foo = array( array(1, 2, 3), array(4, 5, 6), array(7, 8, 9));
                > print json_encode($foo);
                >
                > javascript:
                > var foo = eval('(' + json + ')');
                >
                > alert(foo[0][0]);
                >
                > --
                > The first time, it's a KLUDGE!
                > The second, a trick.
                > Later, it's a well-established technique!
                > -- Mike Broido, Intermetrics
                >
                >
                >
                >
                > Yahoo! Groups Links
                >
                >
                >
                >
                >
                >
                >
              Your message has been successfully submitted and would be delivered to recipients shortly.