Load data from simple external Json file

  • Hi guys,

    I�m just after 4 hours searching marathon. I found two plugins and many hints, but I just started with Construct and I�m totaly confused. Please help with this simple task - I�m lost.

    I have a json file on my server. In this file there are stored several information.

    It looks standard like this:

    {"game":"10"},{"user":"1"},{"score":"1000"}

    I need to read this file in Construct and show these data on screen to the player. Best will be to save each into separate variable.

    Sorry for basic question, but I didn�t found easy answer.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You can load Json strings into a dictionnary object, which can be displayed later, I think the Json string must be written in a certain way (for C2 to understand it is a dictionnary), I can try to found it if you want.

    1/EDIT, the Json File you have should contain:

    {"c2dictionary":true,"data":{"game":"10"},{"user":"1"},{"score":"1000"}}

    or simply, you get your actual file, and add the {"c2dictionary":true,"data": and teh last } later

    2/To load the Json, is it a file in C2, or hosted on a server(the AJAX object can use a GET request to get a Json file from a server If I remember)?

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