我有一个哈希数组的形式
[{"sector":"Consumer, Cyclical","ticker":"NWY","entity":"New York & Co","New_York_&_Co":[{"count":1,"entity":"New York"}],"type":"SCap"}]
我正在尝试列出与所有出现的键值“实体”相对应的值。我确实使用了 json_decode,
$testJson = json_decode('[{"sector":"Consumer, Cyclical","ticker":"NWY","entity":"New York & Co","New_York_&_Co":[{"count":1,"entity":"New York"}],"type":"SCap"}]');
当我尝试 `echo var_dump($testJson[0]); 
它以形式显示输出
array
  0 => 
  object(stdClass)[438]
  public 'sector' => string 'Consumer, Cyclical' (length=18)
  public 'ticker' => string 'NWY' (length=3)
  public 'entity' => string 'New York & Co' (length=13)
  public 'New_York_&_Co' => 
    array
      0 => 
        object(stdClass)[439]
          ...
  public 'type' => string 'SCap' (length=4)
但是echo var_dump($testJson[0]->entity)  或 echo var_dump($testJson[0]->sector) 给我错误..“试图获取非对象的属性”..我做错了什么?