How do I load this JSON file?

  • I've checked out the manual, tutorials, forums and JSON Manager plug in and I can't seem to get the data loaded. AJAX.LastData does have data, but I can't get it into an array or a dictionary.

    dropbox.com/s/qg66n6l7r7cvz2d/lcbot1.json

    I checked its validity as JSON and that's fine. I have it as a file in the project, as well as tried it from calling the API.

    If its the requirement for double quotes, then that isn't viable since this data is returned via an API that I don't control.

    Any thoughts?

  • This JSON has a complex structure, you can't load it into an array/dictionary, even if you fix the header format.

    There are several addons for Construct 2 that allow to work with complex JSON, but I don't know if any of them were ported to C3.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I created the JsonManager plugin and just tried your json and it worked fine. First make sure you include it in the project like:

    then in your events you have to initiate the load like

    Then when you run this I get on the screen 660 as expected. You should also be able to load a json as a string but always wait till the json loaded event has triggered

  • RHG, thanks for the post. I was able to replicate your solution and return a value.

    I'll have to read up on the data handling however as I do confess that I have no idea how to pull out the fields for a specific product_no and their respective numbers.

    As a side note, from what I can tell there's no way to 'debug' and use any of the JsonManager fields etc to see if a JSON load worked. I couldn't see any data. No big deal, but for others who follow this trail.

    Thanks again

    Graham

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