Javascript 某个级别后无法读取JSON对象

Javascript 某个级别后无法读取JSON对象,javascript,php,ajax,json,Javascript,Php,Ajax,Json,这是我的问题- $comment = stdClass Object ( [kind] => Listing [data] => stdClass Object ( [modhash] => [children] => Array (

这是我的问题-

$comment = stdClass Object
        (
            [kind] => Listing
            [data] => stdClass Object
                (
                    [modhash] => 
                    [children] => Array
                        (
                            [0] => stdClass Object
                                (
                                    [kind] => t1
                                    [data] => stdClass Object
                                        (
                                            [subreddit_id] => t5_2qh16
                                            [banned_by] => 
                                            [link_id] => t3_2qgate
                                            [likes] => 
                                            [replies] => stdClass Object
                                                (
                                                    [kind] => Listing
                                                    [data] => stdClass Object
                                                        (
                                                            [modhash] => 
                                                            [children] => Array
                                                                (
                                                                    [0] => stdClass Object
                                                                        (

                                                               .
                                                               .
                                                               .
                                )            
                               [1] => stdClass Object
                                (
                                    [kind] => t1
                                    [data] => stdClass Object
                                          .
                                          .
                                          .
我正在阅读$comment->data->children数组,我能够阅读到$comment->data->children[0]->data->完美地回复

但是当我尝试这个$comment->data->children[0]->data->repress->data->children时,得到的错误是试图获取非对象属性“data”

有什么帮助吗?我做错了什么


顺便说一句,我也尝试过将JSON转换为数组,得到了完全相同的错误

您应该输出
$comment->data->children[0]->data->repress->data
包含的内容,您可能会看到它没有名为children的属性。另一方面,如果您实际上编写了那么长的语句来访问JSON结构中的数据,那么这会有严重的代码味道。请继续查看输出的目的:
var\u dump($comment->data->children[0]->data->repress->data)?您可能刚刚破坏了原始json字符串,我只能获得var_dump的输出($comment->data->children[0]->data->repress)。