Group Group Group Group Group Group Group Group Group

Presenting data from several JSON files

Hi!

Does anyone know a good way to join several json files so that I can present all that data in the same TVML template?

I’m using the code from “tvOS apprentice”, the fifth chapter and have successfully presented data from JSON objects coming from a server rather than locally.

Problem is that when I try to put json-objects in an array, so that I later can join them to one object it doesnt work.

I get this print when printing the whole array (a good print):

[Log] Hello TVML! (main.js, line 34)
[Log] Array (1) (Populator.js, line 10)
0{items: Array, totalExpectedItems: 0, hasMorePages: true}
Array Prototype

But this print when trying to print the first object, array[0]:

[Log] Hello TVML! (main.js, line 34)
[Log] undefined (Populator.js, line 10)

The whole HTTPrequest code I did is using Callbacks and stuff, maybe it has something to do with that?

I dont have any experience joining json files but it seems logical (although a step more) that you could parse the json files into a single database structure or even foundation object such as array or dict and simply work off that structure. If you wanted to join them into a new JSON file you could just serialize the foundation object into a json file as well.