ablemike
ablemike

Reputation: 3394

awesome_nested_set and json

I have a tree of json data. This data contains a nested array of IDs. I need to convert the tree back to awesome_nested_set.

My tree looks like this:

{
    "menu_211"=>
    {
         "menu_135"=>
        {
            "menu_197"=>
            {
            }
        },
         "menu_144"=>
        {
        },
         "menu_208"=>
        {
        }
    },
     "menu_1"=>
    {
         "menu_80"=>
        {
            "menu_81"=>
            {
            },
             "menu_82"=>
            {
        },
         "menu_202"=>
        {
        }
    }
}

What is the best way to convert this to what nested set needs to save the records new left and right fields?

Upvotes: 2

Views: 879

Answers (1)

Related Questions