Traversing JSON

Asked

Viewed 192 times

1

I’m having a little trouble performing a function. I was wondering if you could help me?

Well, I need to do a click navigation and each level is stored in a json. A structure similar to this one below:

{  
   [  
      {  
         "id":"2",
         "atividade":"Andou",
         "children":[  
            {  
               "id":"3",
               "atividade":"Muito",
               "children":[
                    {
                        "id":"4",
                        "atividade":"Final",
                        "children":[

                        ]
                    }
               ]
            }
         ]
      },
      {  
         "id":"5",
         "atividade":"Voltou",
         "children":[  
            {  
               "id":"6",
               "atividade":"Muito",
               "children":[  

               ]
            }
         ]
      }
   ]
}

So I did a for that picks up the first two levels of json, IE, walked back and play on screen with its respective id and index.

What I’m not able to do is to navigate, IE, click on the walk and follow to the next item and when click on the next go to another item and so on. I also need to do the function that make it come back, ie go back by json.

Can someone help me?

Thank you!

  • Renan does not understand your question well. Can you explain better what happens when there is click and where? Take a look here if it helps explain what is missing --> http://jsfiddle.net/ksejhpgw/

  • But what do you want to "walk" on the screen?

  • Sergio, Perfect, that’s exactly what you put together that I was looking for. Thank you very much!

  • Could you please post the code?

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.