How do I import a json file which is then parsed, using BabylonJS native methods?
I’m aware of await fetch(‘link to json’) but I am just curious whether there is a built in function in BabylonJS to achieve that
What does your json contains? if it is a babylon file this is supported: Loading Any File Type | Babylon.js Documentation (babylonjs.com)
my json contains custom data that i use to load meshes into my scene. it’s not in a structure that is familiar to babylonjs
You are basically looking for the xmlHttpRequest or fetch APIs ?
Basically asking if there’s a built-in method/function in babylonJS to fetch the content of a json file. But it doesn’t seem like there is-
I’ll stick to using fetch though, not a big deal anyway
We wrap requests in FileTools.LoadFile where you simply need JSON.parse in the result.
I do not think fetch is supported in Babylon Native, only xmlHttpRequest but let s confirm with the @BabylonNative team
We don’t have fetch, but it would be good to implement if someone wanted to contribute. Then we can start using it on the JS side also.