JSON+Node.js - Unexpected token o
Your colleges
variable is already a valid JavaScript Object. You do not have to use JSON.parse
on it.
JSON.parse
expects a String
as first argument, but you provide an Object
. Thus it is coerced to a String
looking like the one you see in the Error message.
For the rest of your code, you might want to take a look at Express or Zappa to be able to write the code a bit more compact ;)