# Import JSON using BabylonJS method

**URL:** <https://forum.babylonjs.com/t/import-json-using-babylonjs-method/44369>\
**Category:** Questions\
**Created:** [September 22, 2023, 4:35pm UTC](https://forum.babylonjs.com/t/import-json-using-babylonjs-method/44369 "2023-09-22T16:35:24Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![DukeVen](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/dukeven/32/34217_2.png) [@DukeVen](https://forum.babylonjs.com/u/DukeVen)\
**Post date:** [September 22, 2023, 4:35pm UTC](https://forum.babylonjs.com/t/import-json-using-babylonjs-method/44369/1 "2023-09-22T16:35:24Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [September 22, 2023, 4:39pm UTC](https://forum.babylonjs.com/t/import-json-using-babylonjs-method/44369/2 "2023-09-22T16:39:15Z")

</div>

What does your json contains? if it is a babylon file this is supported: [Loading Any File Type | Babylon.js Documentation (babylonjs.com)](https://doc.babylonjs.com/features/featuresDeepDive/importers/loadingFileTypes)

---

<div class="post-metadata">

**Author:** ![DukeVen](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/dukeven/32/34217_2.png) [@DukeVen](https://forum.babylonjs.com/u/DukeVen)\
**Post date:** [September 22, 2023, 4:41pm UTC](https://forum.babylonjs.com/t/import-json-using-babylonjs-method/44369/4 "2023-09-22T16:41:55Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [September 22, 2023, 7:05pm UTC](https://forum.babylonjs.com/t/import-json-using-babylonjs-method/44369/5 "2023-09-22T19:05:54Z")

</div>

You are basically looking for the xmlHttpRequest or fetch APIs ?

---

<div class="post-metadata">

**Author:** ![DukeVen](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/dukeven/32/34217_2.png) [@DukeVen](https://forum.babylonjs.com/u/DukeVen)\
**Post date:** [September 22, 2023, 7:16pm UTC](https://forum.babylonjs.com/t/import-json-using-babylonjs-method/44369/6 "2023-09-22T19:16:16Z")

</div>

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 👍

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [September 22, 2023, 8:10pm UTC](https://forum.babylonjs.com/t/import-json-using-babylonjs-method/44369/7 "2023-09-22T20:10:29Z")

</div>

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](https://forum.babylonjs.com/groups/babylonnative) team

---

<div class="post-metadata">

**Author:** ![bghgary](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/bghgary/32/48532_2.png) [@bghgary](https://forum.babylonjs.com/u/bghgary)\
**Post date:** [September 22, 2023, 8:24pm UTC](https://forum.babylonjs.com/t/import-json-using-babylonjs-method/44369/8 "2023-09-22T20:24:09Z")

</div>

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.
