'How do I determine where a column is as defined in this JSON error message?

I am trying to understand how to identify column 26 from this error message

Uncaught SyntaxError: JSON.parse: expected ',' or '}' after property value in object at line 1 column 26 of the JSON data.

This message is derived from the following code

var notedata = JSON.parse('{"results":"<p><img src=\"https:\/\/helpx.adobe.com\/content\/dam\/help\/en\/photoshop\/using\/convert-color-image-black-white\/jcr_content\/main-pars\/before_and_after\/image-before\/Landscape-Color.jpg\" alt=\"Image test\" width=\"702\" height=\"291\"><\/p>\n<p>This is spaghetti. I now have a working bloke section that looks and works better than my previous one. Update3<\/p>"}');

What do they mean by column and how do I determine where a column starts and stops?



Solution 1:[1]

In this context, column is read as character.

You need to escape your \ with a double \\

var notedata = JSON.parse('{"results":"<p><img src=\\"https:\/\/helpx.adobe.com\/content\/dam\/help\/en\/photoshop\/using\/convert-color-image-black-white\/jcr_content\/main-pars\/before_and_after\/image-before\/Landscape-Color.jpg\\" alt=\\"Image test\\" width=\\"702\\" height=\\"291\\"><\/p>\\n<p>This is spaghetti. I now have a working bloke section that looks and works better than my previous one. Update3<\/p>"}');
console.log(notedata);

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Lee Taylor