IKStreamIvo Posted December 18, 2017 Share Posted December 18, 2017 Hey, I am working on a game that fetches an unknown amount of json files from a webserver. When everything is parsed, I need to combine everything in one big json object. //for loop game.load.json('cards' + i, deckStorageLink + decksData[i][0]); //while testing im only having two, 'cards0' and 'cards1' //different function var deck1 = game.cache.getJSON('cards0'); var deck2 = game.cache.getJSON('cards1'); var fullDeck = //deck1 and deck2 combined. so if I have [ { "country": "0", "points": "1", "action": "5", "description": "Draw two cards" } ] and [ { "country": "1", "points": "1", "action": "3", "description": "Steal a card" } ] I want [ { "country": "0", "points": "1", "action": "5", "description": "Draw two cards" } ] [ { "country": "1", "points": "1", "action": "3", "description": "Steal a card" } ] Does anyone know how to do this? -Ivo Link to comment Share on other sites More sharing options...
IKStreamIvo Posted December 18, 2017 Author Share Posted December 18, 2017 ... Turns out it is as easy as: var deck1 = game.cache.getJSON('cards0'); var deck2 = game.cache.getJSON('cards1'); var fullDeck = deck1.concat(deck2); Fenopiù 1 Link to comment Share on other sites More sharing options...
Recommended Posts