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
39
S
10
G
4
Posts: 149
Reputation: 6,611

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
54
S
28
G
18
Posts: 1,520
Reputation: 25,020

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
39
S
10
G
4
Posts: 149
Reputation: 6,611

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
54
S
28
G
18
Posts: 1,520
Reputation: 25,020


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 1 guest