Search code examples
jsonaws-sdkamazon-cloudsearch

lexical error: inside a string, '\' occurs before a character which it may not


I am using Amazon SDK to upload document to CloudSearch. The document is formatted into JSON. When I try to upload the data it gives me below error-

{ ["lexical error: inside a string, '\' occurs before a character which it may not.
          attern can be escaped with a \ some\ file will match a file 
                     (right here) ------^
 (near operation with index 1; document_id 14266553008620)"] }

I have used JSONLint to validate JSON file and it was successfullt validating.

Why could this be happening?


Solution

  • Resolved by replacing the single backslash with a double backslash (ie a literal backslash).