Is it possible to read in *standard* .json files?

0 favourites
  • 2 posts
From the Asset Store
12 unique hits, slashes and spells in transparent PNG sequences
  • I have a bunch of standard .json files that define components. I was hoping I could use C2 to parse the .json files and create a .png image; but it seems that Scirra uses a special .json format.

    I've got the File Chooser working, and I can grab the text of the file using AJAX. But there doesn't seem to be a good way for me to parse the data. Is it possible?

    Here's what my .json data looks like:


    "name": "basic_gun",

    "columns": 4,

    "rows": 6,

    "tileWidth": 32,

    "tileHeight": 32,

    "tiles": [0, 1, 2, 0, 0, 3, 7, 0, 0, 1, 1, 0, 0, 1, 1, 0, 10, 1, 1, 14, 1, 1, 1, 1],


    There are only 15 values that can go in my grid (which can be variable in size). My plan is to have a 32x32 sprite for each value and lay them out appropriately by columns and rows. Then I'm hoping to be able to take a snapshot of the canvas and invoke a browser save. I'll have to change the canvas size dynamically after reading in the .json file... Is that possible?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Of course it is.

    Use Yann 's JSON plugin or rexrainbow 's Hash plugin.

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