Uncaught SyntaxError: Unexpected token { in ObjectLoader.js:1

I am new to three.js and I am trying to load an object which rendered from blender in json format but it says

Uncaught SyntaxError: Unexpected token { in ObjectLoader.js:1

and also another error

Uncaught TypeError: Cannot read property 'type' of undefined
at ff.parseObject (three.min.js:755)
at ff.parse (three.min.js:745)
at Object.onLoad (three.min.js:744)
at XMLHttpRequest. (three.min.js:650)

this is from console,
please help, thank you!

Like I mentioned at github please share your Blend and JSON file.

Besides, you should load the file with JSONLoader not with ObjectLoader.

Mugen, I am trying to upload a file in this forum but it says I am a new user I cannot upload a file. Actually I checked threejs.org document and loading 3d object using ObjectLoader because the format file is in json format and the object I rendered from blender using threejs add on is in json format, that is why I used ObjectLoader but it shows error.

Please try to load your model with JSONLoader.

I don’t think there’s any need to be so strict on new users adding files - I’ve changed the settings, @Sreypich_Phan you should be able to attach files now.

1 Like

@Mugen87 It works fine with JSONLoader, thank you very much.
@looeee, Thank you very much, I can upload attach files now.

I’m getting the Uncaught SyntaxError: Unexpected token { error as well on ObjectLoader.js:1 as well. I tried switching to JSONLoader.js and get the same error as well as an error telling me I should be using ObjectLoader.js.

@Michael_Riley please share your file.

rabbit.json (82.3 KB)

I’ve tested it on my loader and it loads up ok, although it’s black since it’s missing a texture.

There must be an error in your code - are you using the latest three.js version?

Yes, latest three.js version. Pulled the model from https://clara.io/library and selected three.js as the version to download. Will use that tester in a bit.

Yes, I do see it load in the tester. Any other reason I’d be seeing the error on ObjectLoader.js?

Try making a live example. You can use this basic template on code sandbox, you can also upload the rabbit.json file there: