How do I write JSON in Construct 2

0 favourites
  • 2 posts
From the Asset Store
Game with complete Source-Code (Construct 3 / .c3p) + HTML5 Exported.
  • Hi - I can't write JSON on C2

    I tried many different schema - and always error

    I want to write this code

    {"p1acts":" " , "p2acts":"  " , "status":" "}
  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)