How to convert a JSON into an Array object?

0 favourites
  • 3 posts
From the Asset Store
Supports 1D, 2D, 3D arrays. Import and export arrays in JSON format
  • I have done these steps thinking the "Load" action from the Array object would work out of the box, but I'm apparently missing something.

    This is my JSON.

    This is the block process.

    This is the output from both the arrays.

    So, wouldn't it be fair to assume the Array would get the structure provided by the json? I can't see what I'm doing wrong and I deeply appreciate any help.

    Thanks in advance.


  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Construct arrays have a specific JSON format, as on your third screenshot. If you can change your JSON string to that format, then you will be able to load it directly into the array with "Load" action.

    Otherwise, if your JSON string is like this - "[1,2,4,10]", you will need to loop thought all these values and insert them into the array one by one. Something like this:

    JSON Parse AJAX.LastData
    JSON For each element
     Array Insert JSON.CurrentValue
  • Oh, I just assumed it was any json, now I get it, thanks again DOP.

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