Sign in to follow this  
Nastro

Json File Import

Recommended Posts

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...

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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 :)

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.