0 Favourites

How do I write JSON in Construct 2

  • 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":" "}
    [/code:1ko4vcf4]
    [img="http://i.imgur.com/418TeKm.png"]
  • Construct 3

    Buy Construct 3

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

    Buy 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)