json 2 arrays in one object

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mdbch
    New Member
    • Apr 2012
    • 1

    #1

    json 2 arrays in one object

    hello to all,

    I try to put two arrays inside one json object in javascript. But it's not working.

    here my code:

    Code:
      
      var txt = '{"event":["group1":["player1":[{"name":"markus", "age":"34"}]]]}';      
    
                        obj = JSON.parse(txt);
    My goal is to store the details of a player in a array and than to store the player in a specific group.

    Thanks for any help !
  • Monomachus
    Recognized Expert New Member
    • Apr 2008
    • 127

    #2
    It is not a Java question but anyway.
    Code:
    var txt = '{"event":{"group1":[{"player1":{"name":"markus", "age":"34"}}]}}'; 
    obj = JSON.parse(txt);

    Comment

    Working...