Load JSON to Array Not Working

Get help using Construct 2

Post » Tue May 20, 2014 8:08 am

Hey there,
I am trying to load my JSON file into my array. I used the exact same one that was exported and even a modified one. Neither work at all. Here's a screenshot to show you how I have it coded. Any insight? Something I over looked?
Thank You
You do not have the required permissions to view the files attached to this post.
B
56
S
15
G
13
Posts: 825
Reputation: 17,643

Post » Tue May 20, 2014 9:05 am

@Tekniko

You'll need the JSON as a project file and also need to use the AJAX object to correctly load a JSON to array.

I've added an example of a very simple array editor that I would create to fill in an array for any game I was making. In the "Load Array" layout & event sheet 2 are the correct events for loading data into an array from JSON. You'll have to run the layout in debug mode to see that the array is filled from my saved JSON.

Hope that helps.

Oh and you'll need the latest beta for anyone who wants the CAPX
You do not have the required permissions to view the files attached to this post.
B
46
S
23
G
7
Posts: 459
Reputation: 6,763

Post » Tue May 20, 2014 9:41 am

Wow, I was way off haha. Thank you @Minor.
One last question. Why do you clear the array on start of layout?
B
56
S
15
G
13
Posts: 825
Reputation: 17,643

Post » Tue May 20, 2014 9:50 am

No reason really.

Just something I usually do make sure no un-needed outdated data is in there from other layouts. Probably don't need to just a habit I have of clearing my array before loading data into it.
B
46
S
23
G
7
Posts: 459
Reputation: 6,763


Return to How do I....?

Who is online

Users browsing this forum: MoscowModder and 9 guests