# Convert scene to JSON file and download

**URL:** <https://discourse.threejs.org/t/convert-scene-to-json-file-and-download/7764>\
**Category:** Questions\
**Tags:** json-format\
**Created:** [May 27, 2019, 3:55pm UTC](https://discourse.threejs.org/t/convert-scene-to-json-file-and-download/7764 "2019-05-27T15:55:58Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![blue](https://avatars.discourse-cdn.com/v4/letter/b/3bc359/32.png) [@blue](https://discourse.threejs.org/u/blue)\
**Post date:** [May 27, 2019, 3:55pm UTC](https://discourse.threejs.org/t/convert-scene-to-json-file-and-download/7764/1 "2019-05-27T15:55:58Z")

</div>

Hi!  
I have a simple scene - one THREE.Object3D and a few OBJ models.  
I want to convert data of the scene to JSON file and give to user possibilities to download this file.

Below is the code. This code works to a small objects but not in this case. It means - it works, file is download but i can’t opened it. 😃 I think - it’s too large and this is a problem.

```
function saveLikeJSON(){
var dataJSON = {scene: scene.children} 
var dataJson = JSON.stringify(dataJSON); // // I try JSON.stringify(scene) but it is wrong solution too
downloadTextFile(dataJson,"p")

}

function downloadTextFile(text, name) {
const a = document.createElement('a');
const type = name.split(".").pop();
a.href = URL.createObjectURL( new Blob([text], { type:`text/${type === "txt" ? "plain" : type}` }) );
a.download = name;
a.click();
}

```

How download only nessesary information about the scene and convert they to json file?

---

<div class="post-metadata">

**Author:** ![Mugen87](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/mugen87/32/5645_2.png) [@Mugen87](https://discourse.threejs.org/u/Mugen87)\
**Post date:** [May 28, 2019, 10:45am UTC](https://discourse.threejs.org/t/convert-scene-to-json-file-and-download/7764/2 "2019-05-28T10:45:58Z")

</div>

> [@blue](#):
>
> How download only nessesary information about the scene

What you do you mean with “necessary information”? When calling `Scene.toJSON()` the entire scene graph is serialized which is important if you want to deserialize it at a later point. It’s not possible to restrict the serialization to a subset of information.

---

<div class="post-metadata">

**Author:** ![blue](https://avatars.discourse-cdn.com/v4/letter/b/3bc359/32.png) [@blue](https://discourse.threejs.org/u/blue)\
**Post date:** [May 28, 2019, 12:49pm UTC](https://discourse.threejs.org/t/convert-scene-to-json-file-and-download/7764/3 "2019-05-28T12:49:21Z")

</div>

“Necessary information” is for my all information to need to the deserialize later.  
Ok, i understand that i must use scene.toJSON() - and above code works for it - today file is opening (for a long time but i can open it, i think mistake was my impatience - too early i gave up waiting for opening).

This file is large - circa 240MB. If is any solution to convert a a file to a smaller size (or maybe I do not have to care and leave it as it is? ) to be able to use it later?
