Storing a 3d Array as a Json file on a serve

0 favourites
  • 6 posts
From the Asset Store
Source File, music and art pack for Android Negotiator
  • Can a JSON file of a 3D array be stored/retrieved on a dedicated server? If so, does anyone have a sample .capx which would show this process? If you also had the php script that would be cool, but not necessary. Thanks ahead of time!

    Tagged:

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • If the data doesn't change, you can upload it as a text file. Here is an example:

    dropbox.com/s/z8uno909mhefmvx/LoadJSON.capx

  • First, thanks for the response, Dop. Your capx just pierced the forest, now I can see the trees. Thanks for that. Maybe I'm overthinking this or missing the forest for the trees, but a follow-up context and questions.

    FYI, I will be making adjustments to the data in the array which will migrated to a JSON file. But I'm comfortable with editing strings within an array, so no problem there. Check.

    I'm also familiar with POST/GET processes for loading/downloading txt files to a server. Check.

    So, how do I get the json file to the server? When I download the array to the JSON file it goes to my downloads folder on my computer. I'm presuming that when this app is running on the server it will save to a folder on my server, is that correct? Again, I'm familiar with the php POST/GET processes, but it seems the JSON download event automatically downloads the JSON file to a folder of its choice. How do I instruct it to download a folder of my choice?

    In the alternative can I just save the JSON folder and POST it (via php) to the server file/folder of my choice? If so, how would I do this?

    Thanks.

    PS. Send me that buy a cup of coffee link.

  • I'm presuming that when this app is running on the server it will save to a folder on my server, is that correct?

    No, unfortunately not. If you need to upload changed JSON from the app to your server, you need to send JSON data to a special PHP script which will save it as a file. See comments in this post:

    construct.net/en/forum/construct-2/how-do-i-18/savecsv-file-server-137535

  • I just figured it out from your earlier .capx...just save the array using a JSON "extension" to a text object. SMH why this didn't connect the first time I saw it. So frickin' simple.

    BTW the capx you just sent was what helped me earlier understand the use of php files for accessing server files, so thanks for that.

    I owe you a cup of coffee...need that link, man.

  • No worries! Here is the coffee link :)

    buymeacoffee.com/dop2000

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