Q: SyntaxError: Unexpected token r in JSON at position 38 I was unexpected token r in JSON at position 38 for this code.
var object = JSON.parse('{"isFaceboook" : true,"redirectUrl" : redUrl,"facebookId" : id}');

redUrl and id are initialized and they are strings...

A: Your variables will need to be stringified as well before it can be parsed.
Something like: '{"isFacebook":true,"redirectUrl":"redUrl","facebookId":4}'

A: There's no point to making a JSON string and parsing it:
var object = {
  isFacebook: true,
  redirectUrl: redUrl,
  facebookId: id
};

will work.
