Where can I find a good JSON example C3 project?

0 favourites
  • 7 posts
From the Asset Store
Unlock platyers earning coins, and save it with Localstorage
  • The example JSON project on start page is extremely simple. It does not include setting attrib values in the JSON.

    Here is what I'm trying to do...

    So if my JSON string is: "{ ""ActionId"": [0,0,0,0,0,0,0,0], ""Score"": [0,0,0,0,0,0,0,0] }"

    I do JSON.Parse on that.

    Then I want to change the first ActionId number in array

    Then I want to change the first Score number in array

    Here is a screen shot...

    Here is the debug runtime output. You can see the arrays are simply erased by above code...

    Seems I don't know how to set these array values using the JSON plugin. What am I doing wrong?


  • Ok I see what's happening. JSON.toCompactString is broken. If I use JSON.toBeautifulString, I can see everything is working fine.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • See the "Using BBCode section" of the Text plugin documentation https://www.construct.net/en/make-games/manuals/construct-3/plugin-reference/text

    Square brackets are reserved characters in BBCode, so printing JSON arrays will cause you problems unless you disable BBCode.

  • JSON.toBeautifulString displays the exact same JSON text (that toCompactString chokes on) perfectly. So what does that indicate?...

  • The beautified string will include a newline character after the square bracket, likely preventing the regex responsible for checking from recognising it as a BBCode tag.

  • You may be right. Probably right. Still should be be fixed at some point. It's not affecting me right now so I'm good with it :-)

  • As far as I'm aware there's nothing to fix, your trying to insert a string with reserved BBCode characters into something that reads BBCode... if you don't want this behaviour then turn off BBCode in the Text objects properties and it will treat it as plain text.

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