flaboy Posted February 5, 2014 Share Posted February 5, 2014 Hi thereI've working on very simple game. I use PIXI.AssetLoader to load sprite sheets via associated with .json files. This is example star.json{"frames": {"star0000":{ "frame": {"x":0,"y":0,"w":116,"h":110}, "rotated": false, "trimmed": false, "spriteSourceSize": {"x":0,"y":0,"w":116,"h":110}, "sourceSize": {"w":116,"h":110}},"star0001":{ "frame": {"x":116,"y":0,"w":116,"h":110}, "rotated": false, "trimmed": false, "spriteSourceSize": {"x":0,"y":0,"w":116,"h":110}, "sourceSize": {"w":116,"h":110}},"star0002":{ "frame": {"x":0,"y":110,"w":116,"h":110}, "rotated": false, "trimmed": false, "spriteSourceSize": {"x":0,"y":0,"w":116,"h":110}, "sourceSize": {"w":116,"h":110}},"star0003":{ "frame": {"x":116,"y":110,"w":116,"h":110}, "rotated": false, "trimmed": false, "spriteSourceSize": {"x":0,"y":0,"w":116,"h":110}, "sourceSize": {"w":116,"h":110}},"star0004":{ "frame": {"x":0,"y":220,"w":116,"h":110}, "rotated": false, "trimmed": false, "spriteSourceSize": {"x":0,"y":0,"w":116,"h":110}, "sourceSize": {"w":116,"h":110}},"star0005":{ "frame": {"x":116,"y":220,"w":116,"h":110}, "rotated": false, "trimmed": false, "spriteSourceSize": {"x":0,"y":0,"w":116,"h":110}, "sourceSize": {"w":116,"h":110}},"star0006":{ "frame": {"x":0,"y":330,"w":116,"h":110}, "rotated": false, "trimmed": false, "spriteSourceSize": {"x":0,"y":0,"w":116,"h":110}, "sourceSize": {"w":116,"h":110}}},"meta": { "app": "Adobe Flash CS6", "version": "12.0.2.529", "image": "star.png", "format": "RGBA8888", "size": {"w":256,"h":512}, "scale": "1"}}It works fine on Chrome, iOS Safari, Android browsers but on desktop Firefox got error:SyntaxError: JSON.parse: unexpected character pixi.dev.js:10519What's the problem? Shall I remove specific characters from .json file or change encoding?Please help Quote Link to comment Share on other sites More sharing options...
Sebi Posted February 6, 2014 Share Posted February 6, 2014 First thing I would do is to console.log the response. Then you should see if firefox adds any unexpected characters to it.If the response looks fine, then it might be a problem with the mime type. Quote Link to comment Share on other sites More sharing options...
Alvin Posted February 6, 2014 Share Posted February 6, 2014 Hi,To me your Json looks a lot like it was generated by Flash, if that's the case check its encoding. Flash has the dirty manner to output UTF-16 or something Quote Link to comment Share on other sites More sharing options...
kuuuurija Posted February 6, 2014 Share Posted February 6, 2014 save the .json as UTF-8 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.