Author Options:

JSON.parse: bad control character in string literal Answered

I uploaded a picture to an unpublished instructable and assigned some text to it.  My instructable locked up and spat out this error:

There's been a problem updating your Instructable
SyntaxError: JSON.parse: bad control character in string literal

Now I can't edit the instructable to fix anything.   I have tried deleting the picture from my library, but it will not let me do it unless I remove the picture from the instrructable, which I cannot do.  I decided to create a new instructable with the same information, and when I uploaded the picture to the new instructable, the same error came up.

Any help would be greatly appreciated.



5 years ago

I realize this thread is 6 months old, but I ran into this at work on an enterprise website, and thought I'd provide more information in case anyone else stumbles across this bug posting.

The issue is most likely caused by a copy-paste operation from another location, or a shift-enter in a text box, which can insert inserts an invisible character like a carriage-return in the text being posted.

The JavaScript in the background code uses a JSON object (JSON is JavaScript Object Notation, a way of providing formatted data in JavaScript) which is expecting a particular format to its data. When there is a carriage return or linefeed in the wrong spot, it throws off the code by putting part of the data on 2 different lines, which isn't allowed.

The solution is generally just what was done, delete the suspect text from the note or whatever was being posted, and type it over again. Doing a select-all, copy off to somewhere else, and paste back again doesn't solve the problem, because you'll probably pull the defiant character right back in again. If your post is particularly long, then putting it in a text editor that shows the codes for character returns and line breaks may smoke out the character that is causing the issue if you don't want to write the novel over again.

I'm hoping this helps the next person who bangs their nose on the window trying to fly through this problem.


6 years ago

JSON errors are associated with JAVA, which is what we use as the default image uploader. If you're having troubles there's a link when you upload to "switch to old uploader", this could help you immediately.

You should check to make sure your JAVA is up to date with the latest version, and you have no script-blocking add ons to your browser.

Did this help?


6 years ago

I got around it by inspecting the element, deleting the node, and then deleting the step which contained the pictures.

I would still like some advice on how to avoid this problem in the future. I have no clue what I did to mess it up.


Reply 6 years ago

You could have been working on your ible when they did a system update. They do unannounced updates so you might bump into 503 errors or problems logging in, etc. But the image notes has been wonky before. I guess if you avoid using any symbols in the text and in an ible title you could steer clear as sometimes even simple quotes has been misinterpreted by the editor causing it to choke. Welcome to Instructables.

Directly emailing service@instructables.com seems to be the preferable route to address problems like this.