How do I load JSONData into array?

0 favourites
  • 6 posts
From the Asset Store
Supports 1D, 2D, 3D arrays. Import and export arrays in JSON format
  • EDIT

    I have a list of URLs for individual images in JSON format on my server.

    The file looks like this:

    {"status":"success","response":{"urlLIST":["https://www.mydomain.com/43523455435765/image.png","https://www.mydomain.com/43512882435765/image.png","https://www.mydomain.com/48977352435765/image.png","https://www.mydomain.com/435243400935765/image.png","https://www.mydomain.com/435244567835765/image.png","https://www.mydomain.com/4352431212335765/image.png","https://www.mydomain.com/4356755442435765/image.png","https://www.mydomain.com/4352678879435765/image.png","https://www.mydomain.com/4352432367895765/image.png","https://www.mydomain.com/4352123433435765/image.png","https://www.mydomain.com/4352437899875765/image.png","https://www.mydomain.com/4352678567435765/image.png","https://www.mydomain.com/43524678889035765/image.png","https://www.mydomain.com/4352123423435765/image.png","https://www.mydomain.com/43524560098435765/image.png","https://www.mydomain.com/4352431265495765/image.png","https://www.mydomain.com/4354539982435765/image.png"]}}

    How would be the best way to load each one of these urls (elements) into an array?

    Thank you!

    Tagged:

  • Should I first create a json object to store the data before load the urls into an array? If so how should be formatted this json file to store each url as an array individual element value?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • construct.net/en/tutorials/load-fill-array-json-file-2515

    You can also check this thing called Google.

  • construct.net/en/tutorials/load-fill-array-json-file-2515

    You can also check this thing called Google.

    Well, I know google and I'm sure you know that but that's ok if you just have time to try to be fun, no problem... And I did it search before open a new question here, but unfortunately my experience with json data manipulation apparently its not so good as yours and any of the tutorials that I found had and example like mine. Thanks anyway!

    EDIT

    And it will make more sense if you have linked this tutorial construct.net/en/tutorials/load-json-data-arrays-2566 that shows you how to load a array from a server

    Unfortunately it also doesn't work because its json array format is different from mine and using the action array load from json in my case desnt work.

  • You need to load this data into JSON object first, then parse, then copy to array. See the official JSON template:

    https://editor.construct.net/#open=json

    After parsing you can do:

    JSON For each entry in "response.urlLIST"

    and insert JSON.CurrentValue into array.

  • Thank you very much dop2000, it's working now.

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