How do I write data in json file

0 favourites
  • 12 posts
From the Asset Store
Game with complete Source-Code (Construct 3 / .c3p) + HTML5 Exported.
  • I'm creating a educational game where the user have to write synonyms and antonyms of suggested words. I need to use a previous json data to compare the words and I need to write the words the user wrote in another json file, besides the time elapsed and the points for each word that the user find. I just know how to read json but I don't know how to write all this data.

  • Is it so difficult that no one can answer it??

  • I just know how to read json but I don't know how to write all this data.

    plugin-json-import-export-generate-edit-inspect_t100042

    Besides that, you can get the json from arrays and dictionarys. Fill an array, or fill a dictionary. Store its json in the local storage.

    https://www.scirra.com/manual/188/local-storage

    https://www.scirra.com/manual/108/array

  • > I just know how to read json but I don't know how to write all this data.

    >

    plugin-json-import-export-generate-edit-inspect_t100042

    Besides that, you can get the json from arrays and dictionarys. Fill an array, or fill a dictionary. Store its json in the local storage.

    https://www.scirra.com/manual/188/local-storage

    https://www.scirra.com/manual/108/array

    Thanks

    I've found this plugin but I think that I don't need it. I can use the browser object with "invoke string"command to show the array in browser, but I need to get it as a file saved on my server. Do you know how I can do this?

  • AJAX

    • Scores on a website - LINK
    • Scores on a website 2 - LINK
    • Highscore table - LINK
    • AJAX tutorial example - LINK
    • How do I pull variables out of a PHP page using AJAX ? - LINK
    • Ize's AJAX/PHP practical "Online Highscore" example - LINK
    • More about using PHP - LINK
    • Use GameJolt's API in C2 - LINK
    • Various questions and answers on using AJAX with server-side scripting to make an online game - LINK

    But, if you attent to do things that a normal secured browser will not allow, i cant help you.

    If its gonna be cross domain, then you gots look for that.

  • Anyway to save the json file on my server without using PHP? I just want to save data as name, scores, time left, levels, etc, directly from my game, to be loaded and analysed by a system.

  • Someone could explain to me how could I save the JSON file on my server?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Any good and wise soul to help me to figure out how to save a JSON file in my server?

  • Sorry to se that you havent received any help yet. But just to understand, how do you intent to pass your JSON data to your server if you are not willing to run a webserver script that would accept the incoming data )like a PHP code)??

    You will have to POST the data to some sort of web script, which can read it and save it to the server right?

    BTW how are you reading JSON? I need some help

  • SamRock do you still need help?

    C3 has an inbuilt json reader, you can also read it by opening it in a normal text editor, or you could load json data into a dictionary in c2/c3

    hope this helps if not, write

  • SamRock do you still need help?

    C3 has an inbuilt json reader, you can also read it by opening it in a normal text editor, or you could load json data into a dictionary in c2/c3

    hope this helps if not, write

    Hii there! Thanks for the help. I found this JSON plugin and it helped me with my requirement. Have been using it for all my games now

  • And how do you send a string like that "{

    “email”: "string",

    “firstName”: "string",

    “lastName”: “string”,

    “nickname”: “string”,

    “position”: “string”,

    “score”: 0

    }"

    with the "post to url" ajax paremeter, i've set the "Set Request Header" to "content-type:application/json", but I don't know how to continue

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