Loading JSON array as literal

Get help using Construct 2

Post » Sun Jun 10, 2012 8:09 pm

I made an array (18,1,1) and had it put the contents into a text file as JSON:

{"c2array":true,"size":[18,1,1],"data":[[[1]],[[2]],[[3]],[[0]],[[0]],[[0]],[[0]],[[0]],[[0]],[[0]],[[0]],[[0]],[[0]],[[0]],[[0]],[[0]],[[0]],[[0]]]}

But when I try to put this same thing back into the load action for the same array, it gives me a "syntax error." I'm using it's same output... what's going on?

Thanks!
Follow my CZero development on twitter https://twitter.com/CaptainZeroGame
B
56
S
15
G
5
Posts: 163
Reputation: 7,911

Post » Sun Jun 10, 2012 8:24 pm

If you're pasting that into the text box it has to be a string enclosed in quotation marks and the quotation marks within the string have to be escaped with more quotation marks. Like this:

"{""c2array"":true,""size"":[18,1,1],""data"":[[[1]],[[2]],[[3]],[[0]],[[0]],[[0]],[[0]],[[0]],[[0]],[[0]],[[0]],[[0]],[[0]],[[0]],[[0]],[[0]],[[0]],[[0]]]}"
B
55
S
29
G
19
Posts: 1,520
Reputation: 25,610

Post » Mon Jun 11, 2012 2:37 am

So you need to double quote between every JSON keyword... OK Thanks!
Follow my CZero development on twitter https://twitter.com/CaptainZeroGame
B
56
S
15
G
5
Posts: 163
Reputation: 7,911

Post » Mon Jun 11, 2012 4:52 pm

Basically, yeah. Any " within a string have to be typed as "" as C2 will think a single " is the end of the string.
B
55
S
29
G
19
Posts: 1,520
Reputation: 25,610


Return to How do I....?

Who is online

Users browsing this forum: Ajbael, ColombageEnPLS and 10 guests