DOMException Syntax error code 12


I have come up against a curious issue.

I am trying to add a czml data source into a plain Cesium viewer.

If I open up the Cesium sandcastle and copy the czml code into there, it shows the entities just fine on the view within the sandcastle. However, if I try to add the very same czml code to my own Cesium application, I get a DOMException as below:

DOMException [SyntaxError: “An invalid or illegal string was specified”

code: 12

nsresult: 0x8053000c


The code which I believe is causing the problem is below:

var czmlToAdd = JSON.parse(JSON.stringify(czml));


But like I say, if I pop the czmlToAdd variable contents into the sandbox, everything works just fine.

What could be causing the problem?

Thank you in advance,


Hello Toby,

It looks like you might have some invalid JSON in your CZML. Make sure all strings are properly wrapped in quotations, all brackets are properly matched and you have commas everywhere needed.

You can see how to add CZML to a Sandcastle example here: