How to load json data into array?

0 favourites
  • 4 posts
From the Asset Store
Data+ is the best Data Management solution for Construct 3. It contains 4 Addons (Plugin & Behavior).
  • I tried to write array data as json and log it into browser console and got data like this {"c2array":true,"size":[50,3,1],"data":[[[521],[273],["portal"]],[[867],[373],["tower"]],[[175],[73],["events"]],[[867],[73],["casino"]],[[174],[373],["temporal"]],[[521],[573],["arena"]],[[521],[-427],["portal"]],[[521],[973],["portal"]],[[-605],[-277],["portal"]],[[-605],[-277],["portal"]],[[1560],[-427],["portal"]],[[521],[1573],["portal"]],[[-432],[-1177],["portal"]],[[1474],[1723],["portal"]],[[2080],[-627],["portal"]],[[-1038],[1073],["portal"]],[[-1557],[-527],["portal"]],[[694],[-1927],["portal"]],[[2599],[-527],["portal"]],[[-605],[2223],["portal"]],[[1993],[2023],["portal"]],[[-2164],[823],["portal"]],[[-1557],[-1527],["portal"]],[[954],[-2477],["portal"]],[[3119],[-527],["portal"]],[[2340],[2323],["portal"]],[[-605],[2823],["portal"]],[[-865],[-2627],["portal"]],[[2080],[-2627],["portal"]],[[3639],[-627],["portal"]],[[2946],[2373],["portal"]],[[88],[3523],["portal"]],[[-2423],[1773],["portal"]],[[-2597],[-727],["portal"]],[[608],[-3477],["portal"]],[[521],[4073],["portal"]],[[4245],[323],["portal"]],[[-3203],[423],["portal"]],[[-2250],[-2327],["portal"]],[[3379],[-2077],["portal"]],[[3032],[3023],["portal"]],[[0],[0],[0]],[[0],[0],[0]],[[0],[0],[0]],[[0],[0],[0]],[[0],[0],[0]],[[0],[0],[0]],[[0],[0],[0]],[[0],[0],[0]],[[0],[0],[0]]]}

    but when I try to load it into an array as json I got errors like this

    what I'm doing wrong?

  • It's not escaped correctly for expressions. (you'd need double quotes)

    Why don't you ajax request a project file and load it into the array object?

    Or to not need to escape it you could paste this into a string variables initial value and load that string variable into the array object.

  • I probably found an issue, all items got to be with double quotes.

    and here is another question

    why construct saving data in one format but loading in another?

    bug, feature? forgot to redone from v2?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • It's not escaped correctly for expressions. (you'd need double quotes)

    Why don't you ajax request a project file and load it into the array object?

    Or to not need to escape it you could paste this into a string variable and load that string variable into the array object.

    yeah, I tried to load it a string, but string value showing the same errors as array load block

    I saw the method with Ajax, but honestly tried to avoid modules that I don't need

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