(I don’t want to show the rest of the JSON due to privacy)
VM8206:1 Uncaught SyntaxError: Unexpected token x in JSON at position 107 at JSON.parse () at new_log.php:33:50
The error is clearly due to the \ being an escape character in JSON but I have tried entering the string into the array with an escape to escape the escape: ‘D:\\xampp\\htdocs\…’ and this still gives me the same error – I have even tried \\ and \\ but they just give a slightly different error.
If I put the array into the object as a JSON string then I get the error:
VM8178:1 Uncaught SyntaxError: Unexpected string in JSON at position 96 at JSON.parse () at new_log.php:33:50
despite it being the exact same JSON string as shown above?!
Does anyone know how I can fix this issue? Is there some other way I should be storing filenames in JSON?
Hey mate what you need to do is
Escape your backslashes in your images array.
What you need to do is format your Json data before you send it across the line:
Here is a similar question and answer that will help : How to escape special characters in building a JSON string?