Uncaught TypeError: JSON.stringify is not a function running the example?

https://jsfiddle.net/mkba0ecu/
I am testing out the cube example.

I have an existing web page with lots of stuff on it. I added a button so that server returns the javascript defined in the tag of the cube fiddle example. However it throws an error. Am I not able to dynamically run the code? I do have three.js included (the latest)

Uncaught TypeError: JSON.stringify is not a function
at ShaderMaterial.copy (three.js:9002)
at ShaderMaterial.copy (three.js:13351)
at ShaderMaterial.clone (three.js:8928)
at new WebGLShadowMap (three.js:19875)
at new WebGLRenderer (three.js:23614)
at eval (eval at executeJS (mystuff.js:61), :5:19)
at executeJS (mystuff.js:61)
at XMLHttpRequest.page_request.onreadystatechange (choice.js:41)

I don’t see any errors in that fiddle.

I see a rotating green box (I suppose this is intended) ?

What browser are you using?

The fiddle works, its my own environment that didnt work (throwing the error). But I execute the code using eval on a string, perhaps that is the difference?

Could be. It’s impossible for us to debug without a working sample that we can see that reproduces the exact problem.

Also:

execute the code using eval on a string

This is really scary and shouldn’t be done… at all :joy:

1 Like

I mean eval is neither here nor there.

I found the issue, one particular javascript changed JSON to its own implementation…

1 Like