How do I write JSON in Construct 2

Get help using Construct 2

Post » Thu Jul 27, 2017 11:32 pm

Hi - I can't write JSON on C2
I tried many different schema - and always error
I want to write this code
Code: Select all
{"p1acts":" " , "p2acts":"  " , "status":" "}

Image
B
16
S
6
G
2
Posts: 31
Reputation: 2,196

Post » Fri Jul 28, 2017 12:05 am

I assume that p1acts, p2acts and status are variables.

You need 'escape characters'.
"a" = a string.
So, that "" is a 'kinda sorta operator'.
This means that " gets interpreted. Same for (, and many others.
You need to escape from the interpretation.
"(", to use ( pure as character.
""", to use " pure as character.

For me, personal, that is way over my head, to complicated.
I use local variables, text form.
When you add a text variable to the event sheet, you do not use the "" to mark the value as a string.
It just is a string, because chosen as such.

So. Add local variable 'a' with initial value {"
'b' with initial value ":" " , "
'c ' with initial value ":" "}

That json is now
a& p1acts &b& p2acts &b& status &c
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950


Return to How do I....?

Who is online

Users browsing this forum: Google [Bot], jogindarpradeep and 17 guests