Karl,

I think you mean "other than alpha or underscore" (just to
nit/completeness ;) ) Always safer to go with fully quoted, though I
tend to avoid it myself unless necessary.

var foo = { "1bar" : "is valid", 2bar:"is not", _iam:"valid too",
"this-is":"valid also" }

of course, we should mention accessing them too:

foo["1bar"], foo["this-is"] and foo._iam

Regards,
Peter Higgins

On Wed, Dec 31, 2008 at 9:34 AM, Karl Swedberg <k...@englishrules.com> wrote:
> On Dec 31, 2008, at 7:51 AM, pete higgins wrote:
>
> int and float are reserved words as well. Technically, you are
> supposed to quote all keys (JSON), but in reality you only need to
> quote the reserved ones. "default" gets me every time.
>
> Hi Pete,
> I know you already know this, but just for completeness I thought I should
> mention that you need to quote not only reserved-word keys but also keys
> that have a character other than alphanumeric or underscore.
>
> --Karl
> ____________
> Karl Swedberg
> www.englishrules.com
> www.learningjquery.com
>

Reply via email to