In the last two days, I encountered the strange error while importing data using Import feature. Here is the error message I saw in the Import dialog window: SyntaxError: Unexpected token < in JSON at position 0
I am really sure, that there is no wrong syntax/code I wrote related the Import server event. But the strange is, that error was suddenly just happened.
Once upon a time, that error is gone. Hey? What I did?
Well, I deleted ALL the generated script files, and then re-generate ALL the script files from stratch again.
After investigating the problem, i found out that the cause of issue is... if we generate the script files and then the package were not successfully complete downloaded (by enabling Composer update), then that error above was happened. Even the previous generating process was successfully.
So, for those of you who encounter that problem, the solution is just simple:
1. Just remove ALL, yes... ALL the generated script files.
2. After that, re-generate ALL the script files again from scratch.
That's it! When you run the Import data again, then everything is just back to normal. The error is gone.
So glad I found out this solution after struggling for two days. Hopefully this would help you, too.