Fill array with data using Load from JSON string.

Get help using Construct 2

Post » Wed Feb 13, 2013 2:54 pm

I have found a weird problem and i was hoping that somebody would be able to help me. The problem is that when i try to load (be it a variable or AJAX) requested data into an array it does not fill an array with data. Though when i simply put the json string into the Load from JSON string it works fine.

I have been searching around and found one other person with a similar problem to mine but there was no answer to his/her question really.

https://www.dropbox.com/s/fhwxzuliiyvevgm/variable_to_array_problem.capx

JSON code:
[code]
"{
""c2array"":true,
""size"":[21,1,4],
""data"":[
[[8,1,0,330]],
[[10,2,1,110]],
[[12,3,2,220]],
[[14,4,1,110]],
[[16,1,0,330]],
[[18,2,1,220]],
[[20,3,1,110]],
[[22,4,0,330]],
[[24,1,1,110]],
[[26,1,0,220]],
[[28,2,1,110]],
[[30,2,0,160]],
[[32,3,0,330]],
[[34,3,1,180]],
[[36,4,0,110]],
[[38,4,1,250]],
[[40,3,1,110]],
[[42,2,0,290]],
[[44,1,1,330]],
[[46,3,0,110]],
[[48,2,2,170]]
]
}"[/code]

In the above example i simply put the json line into a variable but i have also tried to use an ajax request (after uploading the json files/compiled project to the server) also without success.

Its probably some really silly small thing that i am missing.
Hopefully somebody is able to help me with this.
B
2
Posts: 9
Reputation: 443

Post » Wed Feb 13, 2013 5:55 pm

You don't need the extra quotation marks if you're storing it in a variable or in a file.
B
54
S
28
G
18
Posts: 1,520
Reputation: 24,990

Post » Wed Feb 13, 2013 7:34 pm

Ah thank you always the small little things :D

B
2
Posts: 9
Reputation: 443


Return to How do I....?

Who is online

Users browsing this forum: Pandadoor, Sotir31, Yahoo [Bot] and 28 guests