How to fix "Unexpected token < in JSON at position 0"?

Hi Onehackers,

All those brilliant programmers out there I need your help. I downloaded the Geolayers Script for After Effect. When I am using it to create a route from one destination to another, I got an error message saying “Unexpected token < in JSON at position 0”.

I am unable to use this script in After Effects because of this error. I would appreciate your help on this. Thanks!

1 Like

it means that the API is returning html/XML when it is expecting JSON. if it’s a public endpoint, try using postman to view it. if it’s XML, it’s likely there’s an error(404 page, etc.)

put your json data in any online json editor or beautifier.
check if u miss sometihng while copy.

Your Script is Expecting a JSON Response from the server, but instead it received a HTML response. that’s why you causing this issue, To fix this issue, make sure to,

  1. Check the data that your send along with the request is in correct format and in the correct type.
  2. Check the url that you requesting data from is correct
  3. Read carefully API provider docs
  4. Check request method ( POST, GET, PUT, DELETE )

Hope this helps.

1 Like