Nastro Posted August 16, 2016 Share Posted August 16, 2016 Hi I have a Json File and i need to import it in Babylon to display somes polylines etc with Json data. I use 2.5 version of Babylon. Any ideas ? I tried to use JSON.parse but no work... Quote Link to comment Share on other sites More sharing options...
Wingnut Posted August 16, 2016 Share Posted August 16, 2016 Hi Nastro. json parse DOES work... http://www.babylonjs-playground.com/#1GBPXG#2 So, perhaps, the file retrieval is failing. Can you open your browser F12 dev tools and look at the network tab... see if there are any json file load failures? Just some early thoughts. Just for fun, here is another version of that playground, but with LOTS of json data. http://www.babylonjs-playground.com/#251QRF#17 I found these examples by using a playground search for 'parse'. *shrug* Hope this helps. Quote Link to comment Share on other sites More sharing options...
Nastro Posted August 16, 2016 Author Share Posted August 16, 2016 Thanks you a lot Wingnut ! I will see examples, and i think my json file is KO. But i have no warning or error message on my browser ... Wingnut 1 Quote Link to comment Share on other sites More sharing options...
Wingnut Posted August 19, 2016 Share Posted August 19, 2016 Cool! Write back if you need more assist... use the @Wingnut blue label thing... to pingnut the wingnut (it will make a gah-bleep noise in my browser, telling me that you have posted.) JSON file format might be OK, but maybe load is failing. Try to use the BABYLON assetsManager and add it as a "task". There is good callback (onSuccess) options there. I'm not sure if a JSON file can be loaded that way, but a .babylon file is also JSON, so, why not? Should work. Good luck. If successful, we would love to see a playground of it, so others can look and learn. thx. Quote Link to comment Share on other sites More sharing options...
Nastro Posted August 23, 2016 Author Share Posted August 23, 2016 It's ok I use $.getJSON("file.json") and after i get all objets that i need to modelize my differents meshes. Sorry but it's a professionnel project so i can't create a playground but next time i could send an example with an other json to show us. Thanks again @Wingnut Wingnut 1 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.