Sign in to follow this  
ipop

Tiled json export

Recommended Posts

Wow! goes  a bit above my head .. been lokoing at the json export from tiled, which looks pretty simple. Im just learning JS so im confused as to what the pixi loader/parser does with any json it loads .. as it seemingly parses the data when it loads?  how do you access the object(s)?

Share this post


Link to post
Share on other sites

It loads the json via ajax, which will return the content as a string. Then you parse the json into an object and use it. For example:

//pretend this is loaded via ajaxvar data = '{ "my": "json data", "someArray": [1,2,3,4,5] }';//now parse the string JSON into an objectvar obj = JSON.parse(data);//use the objectconsole.log(obj.my); //outputs "json data"

Share this post


Link to post
Share on other sites

 

It loads the json via ajax, which will return the content as a string. Then you parse the json into an object and use it. For example:

//pretend this is loaded via ajaxvar data = '{ "my": "json data", "someArray": [1,2,3,4,5] }';//now parse the string JSON into an objectvar obj = JSON.parse(data);//use the objectconsole.log(obj.my); //outputs "json data"

Many thanks .. im making a lot of mistakes with my code (but enjoying the challenge) .. you think people would mind me throwing stuff up here so i can learn ... maybe i could write it up for you in return as some noob tutorials?

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.