Javascript Can';我不能用json获取我的js数组

Javascript Can';我不能用json获取我的js数组,javascript,jquery,json,Javascript,Jquery,Json,以下是我的功能: function browsepage_from(starting_node) { //record the properties of the object var account_to_rec = new Array(); var property_name var properties = $(starting_node).children('div').children("p").each(function(){ prop

以下是我的功能:

function browsepage_from(starting_node)
{
    //record the properties of the object
    var account_to_rec = new Array();
    var property_name
    var properties = $(starting_node).children('div').children("p").each(function(){
        property_name = $(this).attr('class').split(' ')[1];
        account_to_rec[property_name] = $(this).html();

    });
    //push the object with properties newly created into a global variable

    to_save.push(account_to_rec);

    //check if children
    if($(starting_node).children('ul'))
    {
        $(starting_node).children('ul').children("li").each(function(){
            browsepage_from($(this))

        });
    }
    else
    {

    }

}
没什么特别的

保存
是一个全局变量:

 to_save = new Array();
但在控制台中,我的数组如下所示:

[[]


account_action
        "none"

account_code
        "000000"
bla bla

[]


account_action
        "none"

account_code
        "600000"
bla bla

]
如果我使用JSON.stringify(在finished to_save上或在recursive on each account to_rec上),我只会得到空括号作为结果

这是怎么回事?

Probablu错误在这里

var account_to_rec = new Array();
然后你试着在

property_name = $(this).attr('class').split(' ')[1];
account_to_rec[property_name]=$(this.html()

也许吧

 var account_to_rec = {};

??

您能提供一些代码吗?