How do I load array with json data

0 favourites
  • 11 posts
From the Asset Store
Data+ is the best Data Management solution for Construct 3. It contains 4 Addons (Plugin & Behavior).
  • how do i load data from a json file into an array? Having trouble following the tutorials/manual on this. I can get the data into my program, but not into the array object. My array remains empty. Can anyone give a simplified step by step way of doing it?

  • .. I can get the data into my program, but not into the array object. My array remains empty. ..

    array.json

    {"c2array":true,"size":[3,1,1],"data":[[["one"]],[["two"]],[[3]]]}[/code:1d0yfgst]
  • Thank you koorbach. When I run debug mode, I can see the data from the file when i click on 'ajax', but when i click 'array' the 3 array values are empty.

  • Thank you koorbach. When I run debug mode, I can see the data from the file when i click on 'ajax', but when i click 'array' the 3 array values are empty.

    That sounds like the array.json file was not added to the capx file.

    Here's an example.

    https://www.dropbox.com/s/j730z3m05rjnw ... .capx?dl=0

    Explained

    1. Saved array.json file to the same folder.

    2. Right clicked [Files] under Projects Property and selected [Import Files].

  • I've have imported the arraytext.json file into Projects/Files/icons but the array still shows only 0,0,0. Not real clear on what is meant by '1. Saved array.json file to same folder'.

  • I've have imported the arraytext.json file into Projects/Files/icons but the array still shows only 0,0,0. Not real clear on what is meant by '1. Saved array.json file to same folder'.

    That's just one of the steps I took. I copied the json file to the same folder that contained .capx, but I don't think that's necessary.

    Could you post your capx, please?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Unfortunately, I do not know how to post the capx.

  • Hope i've done this dropbox thing right ... when i run the capx and debug, i have all 0 values in the array.

    https://www.dropbox.com/s/r5tg6rae02hvz ... .capx?dl=0

  • {"arraytext02":true,"size":[3,1,1],"data":[[["one"]],[["two"]],[[3]]]}

    {"c2array":true,"size":[3,1,1],"data":[[["one"]],[["two"]],[[3]]]}]

    not "yourFileName":true,"size":..... OR "yourArrayName":true,"size":.....

    it's always c2array !!!

  • Bingo! Gmoney - you led me to learning how to post a capx ... Korbaach - you found the error. Thank you guys.

  • Bingo! Gmoney - you led me to learning how to post a capx ... Korbaach - you found the error. Thank you guys.

    You're welcome, delusan. I'm glad the issue was resolved.

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