views:

21

answers:

2

I have a json object that follows the following structure:

$foo->bar['1']->#foobar

The hash is causing it to fail, how do I get the value of #foobar?

Thanks

+3  A: 

Try the curly brace syntax:

$foo->bar['1']->{'#foobar'}
Gumbo
A: 

When you use PHP's json_decode, pass true as the second variable, that will return an associative array, those are easier to deal with in such cases.

aularon