{"action":"created","issue":{"url":"https://api.github.com/repos/mrdoob/three.js/issues/8300","repository_url":"https://api.github.com/repos/mrdoob/three.js","labels_url":"https://api.github.com/repos/mrdoob/three.js/issues/8300/labels{/name}","comments_url":"https://api.github.com/repos/mrdoob/three.js/issues/8300/comments","events_url":"https://api.github.com/repos/mrdoob/three.js/issues/8300/events","html_url":"https://github.com/mrdoob/three.js/issues/8300","id":138732420,"number":8300,"title":"JSONLoader won't load ouput from toJSON","user":{"login":"fsparv","id":1226061,"avatar_url":"https://avatars.githubusercontent.com/u/1226061?v=3","gravatar_id":"","url":"https://api.github.com/users/fsparv","html_url":"https://github.com/fsparv","followers_url":"https://api.github.com/users/fsparv/followers","following_url":"https://api.github.com/users/fsparv/following{/other_user}","gists_url":"https://api.github.com/users/fsparv/gists{/gist_id}","starred_url":"https://api.github.com/users/fsparv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fsparv/subscriptions","organizations_url":"https://api.github.com/users/fsparv/orgs","repos_url":"https://api.github.com/users/fsparv/repos","events_url":"https://api.github.com/users/fsparv/events{/privacy}","received_events_url":"https://api.github.com/users/fsparv/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-03-05T23:13:51Z","updated_at":"2016-03-06T08:58:59Z","closed_at":"2016-03-06T08:58:59Z","body":"If this is not a bug, consider it a feature request :) \r\n\r\n    17:47:43.450 TypeError: vertices is undefined\r\n    parseModel() three.js:14990\r\n    THREE.JSONLoader.prototype.parse() three.js:14930\r\n    THREE.JSONLoader.prototype.load/<() three.js:14906\r\n    THREE.XHRLoader.prototype.load/<() three.js:14683\r\n    1 three.js:14990:4\r\n\r\nwhen I try to use JSONLoader to load the output from this code:\r\n\r\n        <script src=\"js/ThreeCSG.js\"></script>\r\n \r\n        var mesh = intersect(\r\n                new THREE.SphereGeometry(50, 20, 20),\r\n                new THREE.SphereGeometry(50, 20, 20),\r\n                new THREE.Vector3(0, -66, 0),\r\n                new THREE.MeshBasicMaterial({color: 'white'}));\r\n        console.log(JSON.stringify(mesh.toJSON()));\r\n\r\n        function intersect(geo1, geo2, offsetVector3, material) {\r\n            var mesh1, mesh2, bsp1, bsp2;\r\n\r\n            mesh1 = new THREE.Mesh(geo1);\r\n            mesh1.position.add(offsetVector3);\r\n            bsp1 = new ThreeBSP(mesh1);\r\n            mesh2 = new THREE.Mesh(geo2);\r\n            bsp2 = new ThreeBSP(mesh2);\r\n            var resultBsp = bsp1.intersect(bsp2);\r\n            var resultMesh = resultBsp.toMesh(material);\r\n            resultMesh.geometry.computeVertexNormals();\r\n\r\n            return resultMesh;\r\n        }\r\n\r\nMesh thus created renders just fine in the browser and in AltspaceVR, but when I tried to store the pre-computed mesh to speed things up I got the above error.\r\n\r\nLoading is like this (It dies before I get to \"do stuff\"):\r\n\r\n    var GOBAN = {\r\n            objLoader: new THREE.JSONLoader(),\r\n    }\r\n\r\nthen later\r\n\r\n    GOBAN.objLoader.load(\"js/stone.json\", function (geom, mat) {/*do stuff*/});\r\n\r\nI notice that the JSON produced has verticies in a deeper level, and that the THREE code is looking for them on the top level...\r\n\r\n```\r\n{\r\n  \"metadata\": {\r\n    \"version\": 4.4,\r\n    \"type\": \"Object\",\r\n    \"generator\": \"Object3D.toJSON\"\r\n  },\r\n  \"geometries\": [\r\n    {\r\n      \"uuid\": \"472B9580-2C78-4B39-96B9-33F6A4AA8167\",\r\n      \"type\": \"Geometry\",\r\n      \"data\": {\r\n        \"vertices\": [\r\n          0,\r\n          50,\r\n          0,\r\n          -7.821723461151123,\r\n          49.38441848754883,\r\n```\r\nproduced in r73 from here: \r\n\r\n    <script src=\"http://sdk.altvr.com/libs/three.js/r73/build/three.js\"></script>\r\n"},"comment":{"url":"https://api.github.com/repos/mrdoob/three.js/issues/comments/192839901","html_url":"https://github.com/mrdoob/three.js/issues/8300#issuecomment-192839901","issue_url":"https://api.github.com/repos/mrdoob/three.js/issues/8300","id":192839901,"user":{"login":"mrdoob","id":97088,"avatar_url":"https://avatars.githubusercontent.com/u/97088?v=3","gravatar_id":"","url":"https://api.github.com/users/mrdoob","html_url":"https://github.com/mrdoob","followers_url":"https://api.github.com/users/mrdoob/followers","following_url":"https://api.github.com/users/mrdoob/following{/other_user}","gists_url":"https://api.github.com/users/mrdoob/gists{/gist_id}","starred_url":"https://api.github.com/users/mrdoob/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mrdoob/subscriptions","organizations_url":"https://api.github.com/users/mrdoob/orgs","repos_url":"https://api.github.com/users/mrdoob/repos","events_url":"https://api.github.com/users/mrdoob/events{/privacy}","received_events_url":"https://api.github.com/users/mrdoob/received_events","type":"User","site_admin":false},"created_at":"2016-03-06T08:58:59Z","updated_at":"2016-03-06T08:58:59Z","body":"You should use `ObjectLoader` instead."}}