Loading JSON files

Hey im building a JSON to GLTF Converter for my project. We want to switch from .json format to gltf 2.0. I tried the LegacyJSONLoader, which throws the error:

JSONLoader "path to file" should be loaded with THREE.ObjectLoader instead.

Using the ObjectLoader.js all my models are black and throws:

Uncaught SyntaxError: Unexpected token { at line: 1 of ObjectLoader.js

Implemented like:

<script src="three.js-master/build/three.min.js"></script>
<script src="three.js-master/examples/js/WebGL.js"></script>
<script src="three.js-master/examples/js/exporters/GLTFExporter.js"></script>
<script src="three.js-master/examples/js/loaders/deprecated/LegacyJSONLoader.js"></script>
<script src="three.js-master/src/loaders/ObjectLoader.js"></script>
<script src="three.js-master/examples/js/controls/OrbitControls.js"></script>
<script src="filelist.js"></script>
<script src="main.js"></script>

In main.js
var legacyJsonLoader = new THREE.LegacyJSONLoader();
var objectLoader = new THREE.ObjectLoader();

Related:

In any event, can you please share one of your JSON files in this thread?

container.zip (12.7 KB)

The objectLoader error happens before any json model is loaded. It’s actually thrown right after import

If you include LegacyJSONLoader into your application, the mentioned errors of your first post should not appear when you load the file with THREE.ObjectLoader. However, I’m not sure the visual output is correct:

image

Mhh, still getting those errors, but its not appearing black anymore. Im applying the textures back again via code, but i want them embedded. This may be a clara.io problem
The result is not correct, textures/colors are not applied.
And is this flatShading = false? Everything looks so rounded. This happens with most of my models when no flatshading is applied. Was wondering where this is coming from before. Could you explain that?

In Clara.io looks like this:
Capture

Reimporting it to clara looks like:
Capture2

No, I don’t know what’s going on. Where do your models come from? clara.io?

Yes they come from clara.io. I made them there and exported them to JSON.
When reimporting them to clara, they are also not displayed correctly.

Then I would report the issue to clara.io. I originally wanted to suggest that you reimport your models and then export to glTF.