我想解析这个json:
{"all":6154, "watchers":{"1":2193,"2":610,"3":228,"4":253,"5":477,"6":302,"7":116,"8":15,"9":731,"10":421,"16":52,"15":133,"17":77,"18":50,"19":132,"103":56,"104":92,"105":44,"108":41,"109":67}}
在PHP中,但是如何获得观察者1? 如果我愿意
$json = file_get_contents("https://www.----.json");
$data = json_decode($json);
$number = $data->watchers[0]->1;
“ 1”被识别为整数,并且出现PHP错误。
PHP message: PHP Parse error: syntax error, unexpected '1' (T_LNUMBER), expecting identifier (T_STRING) or variable (T_VARIABLE) or '{' or '$' in ...
如何正确解析?谢谢!