JSON Manager PlugIn in Development

  • I am putting together a Json Manager Plugin for my own game and have gotten pretty far with it. I wanted to see if others would be interested in this when it is totally complete.

    The idea is to load Json objects from files into named slots, so that they can be referenced later in the event sheet.

    The goal is to allow access to items using standard Json object syntax for accessing properties and array items.

    So a sample json file would look like this.

    To specify Json files to load and the slots to put them in is done through the plugins properties like shown below. Using comma separated lists.

    To load the Json and access properties in an event sheet you can do

    You will notice that you load the json files and then an event is triggered when complete and a value is accessed within the object and array to display on the screen using standard Json syntax.

    Next steps:

    1) Add expressions to access array count based on a json path.

    2) Add a loop condition to iterate over an array based on a json path.

    3) Error handling.

  • A pretty much badly needed plugin :)

  • Just to give a quick update. I think the Json plugin is about done. And I am finishing up the documentation for it, so hopefully I'll have it up in the next day or two. Error handling is a little on the weak side, but I'll enhance that soon.

    Also I only implemented this for the c2 run time at the moment, but I will look at adding the c3 runtime soon. I'll post again when it's up in the repository.

  • Just to give a quick update. I think the Json plugin is about done. And I am finishing up the documentation for it, so hopefully I'll have it up in the next day or two. Error handling is a little on the weak side, but I'll enhance that soon.

    Also I only implemented this for the c2 run time at the moment, but I will look at adding the c3 runtime soon. I'll post again when it's up in the repository.

    Hello, I need the plugin for C3.

    Can you sell me a copy?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • The plugin is for C3 just using the old runtime. I will shortly make work also for the new runtime that is currently in alpha.

    The new runtime is being fixed and improved at a rapid pace and Ashley has even said that people shouldn't be using the new runtime other than to play with it and help find bugs.

    I am just finishing up the documentation and I'll be releasing it shortly.

  • I did just post the plug in. I'm sure it may need some more functionality, but it appears to be working correctly. Please look at the included example project for details of how to use it.

  • Can't load json, cross-origin problem

    GET editor.construct.net/r106/preview/%22gamedata.json%22 500 ()

    index.html:1 Failed to load editor.construct.net/r106/preview/%22gamedata.json%22: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://preview.construct.net' is therefore not allowed access. The response had HTTP status code 500.

    blob:https://preview.construct.net/32c45618-b156-499f-bfdc-391d6b7d388c:2 Json ajax file retrieve falied - 0 -

    Cross-Origin Read Blocking (CORB) blocked cross-origin response editor.construct.net/r106/preview/%22gamedata.json%22 with MIME type text/html. See chromestatus.com/feature/5629709824032768 for more details.

  • Are your json files in the files folder ?

    I didn't set up or test loading files from an external source, which in theory should work. However, additional work would be required to allow cross origin requests.

    Did you try the example I included, it works with files located locally in the projects ?

  • just tried it in a preview window (it's where I spend most of the time developing/testing)

  • Was that your application or the sample one that I included ?

  • The sample that I included seems to work for me so I'll have to look at that if that's not working for you

  • I am actually explicitly looking in the local files in a project for the json file. I can modify the code to be able to make external requests also.

  • It was my application, I'll take a look at your example. Yeah external requests might make sense

  • Ok, I posted a note in the documentation pointing out that it only works with local files right now and I'll add support for remote files

  • I just published version 0.5.1. It allows json files to be loaded by url also. It's mentioned in the release notes and in the documentation, you do have to be careful with this.

    The plugin was originally designed to work with files local to the project.

    The preview windows runs with https(ssl) so if you try to call to your web server on your local machine to serve up a json file with http, it will fail.

    You can get around these issues for local testing by using http://127.0.0.1:port# , Since this is trusted by browsers and it will allow a call from https to http. However you may need to set your local web server to respond with Cors headers to get it to work.

    When I did this I was able to load the two files in the included example plugin test and a third one from a url on my local machine.

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