Oh wow, I didn't realize JSON would act like an associative array in that
way...

Thanks guys!

On Fri, Feb 13, 2009 at 7:10 PM, Josh Nathanson <joshnathan...@gmail.com>wrote:

>
> foo[fooProp] // returns "barVal"
>
> Is that what you mean?
>
> -- Josh
>
>
>
> -----Original Message-----
> From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
> Behalf Of Nic
> Sent: Friday, February 13, 2009 4:06 PM
> To: jQuery (English)
> Subject: [jQuery] Accessing a JSON property from an unknown variable?
>
>
> For instance,
>
> var foo = {
> "bar": "barVal",
> "baz": "bazVal"
> }
>
> var fooProp = "bar";
>
> How can I access barVal through fooProp?
>
> I know this isn't exactly jQuery group discussion but I figured since
> it was part of a jQuery system I could get away with it. Thanks!
>
>

Reply via email to