So, The error is so obvious that I got many results for the same but however none of the fixes I found seems working right.. I am just calling a JSON API which results in "string" response only..

However when I passed it through JSON.parse it is throwing Unexpected Token error.. Below is the sample API code,

```
{
  states: [
    {
      name: "Gujarat",
      cities: [ ]
    },
    {
      name: "Haryana",
      cities: [
         {
          name: "Faridabad",
          url: "faridabad",
          popular: false
         },
         {
          name: "Gurgaon",
          url: "gurgaon",
          popular: false
         }
      ]
   }
  ]
}

```

and this is the coffeescript code I am trying to execute,

```
request = require 'request'

url = "http://example.com/example.v1.json"

request url: url, json: true, (error, response, body) ->
  if !error && response.statusCode == 200
    jsonObject = JSON.parse body
    console.log typeof(body)

```

and the JS version

```
// Generated by CoffeeScript 1.8.0
(function() {
  var request, url;

  request = require('request');

  url = "http://example.com/example.v1.json";

  request({
    url: url,
    json: true
  }, function(error, response, body) {
    var jsonObject;
    if (!error && response.statusCode === 200) {
      jsonObject = JSON.parse(body);
      return console.log(typeof body);
    }
  });

}).call(this);

```

The error I am getting is,

```
SyntaxError: Unexpected token 
    at Object.parse (native)
    at Request._callback (/Users/avinoth/learnrepo/Reponame/newtest.js:15:25)
    at Request.self.callback (/Users/avinoth/learnrepo/Reponame/node_modules/request/request.js:121:22)
    at Request.emit (events.js:98:17)
    at Request.<anonymous> (/Users/avinoth/learnrepo/Reponame/node_modules/request/request.js:978:14)
    at Request.emit (events.js:117:20)
    at IncomingMessage.<anonymous> (/Users/avinoth/learnrepo/Reponame/node_modules/request/request.js:929:12)
    at IncomingMessage.emit (events.js:117:20)
    at _stream_readable.js:943:16
    at process._tickCallback (node.js:419:13)

```

The data passed is a string type only..

And not only for this api, I even tried for different api like <https://osrc.dfm.io/avinoth.json>

The JSON is successfully parsed without any errors using this link, <http://json.parser.online.fr/>

kindly help me out..

```
{ 'content-type': 'text/html; charset=UTF-8',
  'content-length': '1436',
  connection: 'keep-alive',
  date: 'Mon, 08 Dec 2014 10:27:34 GMT',
  'cache-control': 'public, max-age=5, s-maxage=5',
  'content-encoding': 'gzip',
  'last-modified': 'Mon, 08 Dec 2014 10:26:36 GMT',
  etag: '"ed710ee54481a6d6e30da823bd19a511"',
  'accept-ranges': 'bytes',
  server: 'AmazonS3',
  'x-cache': 'RefreshHit from cloudfront',
  via: '1.1 05b6ee20d35c57dfb14b821a9c7edd15.cloudfront.net (CloudFront)',
  'x-amz-cf-id': 'ZuUcdEqp-ip1GY51NX9A8x-5lwBpaEo9uX1gQK7N5gWn_mMmAvo3og==' }

```

and just now I noticed, the response body is just a blob of unrecognized characters...

```
'\u001f�\b\u0000�|�T\u0000\u0003��Qo�6\fǿJ��\u0006}���6l���b+6`�=бf+�dC�\\$E���8�(5�\u001e\u0002��g[2ER|�M\u001e��v����,\u0018�{�}g���ݳ�ZM��~w�^\u0017�\u0018�a\f\u000e\f\u000e\u0007ף\u0004T\u001a�1��v��B?��{ro�`��W\t�\u0012\u000b~j��\u0019�\u0013+*��PU�׉�6�|n��\u000e\u001a�\u0012v�4\u0001�=N�\u000fN��\u0013���\u001bX��\u000fS��T\u0014a�\f��`"\n�P\u0017+|�\u0012\u000b���\n�QW���G8�W\\�H4I��a��D\\-���S��ND\u0012D(�\f��\u0002���+K�(��O��a$�i��B?�m���>5�:������\u0017贅:�l�\u0004\u0001�t\u0015��RIᱡ�.�m&\u000f\u0004g�!}�.�,�+t]��=�X�+\u001cZ��W3I\u0010!�\u001a#xK\u001eh\nU��*TPAMX"\t��\u0001C\u0006}ۤ��\u0013^t"�o�- \u000e&�\r4n�\\��\t�S�$�P��6�xT���R\u000e����pֳRurKK\u0014\u0016��6\u0003IV�f��3�\u0019�Γ㘋\u0002|�(��7ܽ\u0004��-��ޯC��0&\u0014\tz�\u0012\u000b�\u000eGhM�\\�­�4\u0016�\u0003�W���S.���\u0018�p,��D%\u0016|�����7�\u0007�\u000b�a\u0004I�\b�4��$�П��\u001f��\u0006ݙJ\u0002hC7،K��MеPl��P\u0005���\u0018k��:�b\u0001�r����<��b��0Se�BE�x[�BV��rѰRE[(/jhHm�Z|:\u000eU������\b�3|=Mt"f3��Qn�\u000bn�Ҹ3�Q��\u0006I\u0010�h�Y\u0011d ӄ����A�eO��v�,����2K�\u0002"\te\u0001^u"o�%�_��I����\u0014\u0000\f�\u001e+�sK�f.\n��\u000e沐$�\u0010I��\'����H\u0014\u001e�5�)\u0014m>\u0014�K�����-B��5���%��\u0007��%��\u000b\u0018��=�%a��c\\�,�\u0003Q�c�³\r=�l6���\u0007m*�4�\u001f��>��\u0016�X�b5�\u0004�G\u0007\u0000}蔽{�Ye>���c\u001c�o�5�oC�qi&\u0015r���2��Rt&�I������]�\t9�\'Ǎ�j\t�\t��S ~E\u0014\u0001S���WKL�8e�ƪ<���x\u000b,\u001agU�I�뇱�:�ͬ��\u001e���5B��<����\u0001$�O\u0002�\fCz\u000f�L�\u0017�e2�|ѪL\u0013�/����D�L\u0013:0��l�6S8�_�\u000e\u001a�\u0016�\u0016M��)\u001d����SK%�\u00168c$�_�%��]J���$\u001e<ժx\u001eQ����r�jSTy�P�VB]��D\u0011��kr�<F[@����x!\u0014��n�`\t��b�^� �]:�H��6����$�����E�GZ�<M\u001cі�(�9��%5\u000b�\u000fI��!\n�)���&\t<��\t�G\u0013�.3�&���&۝6\t<���\r��\u0014�3z\u0000�\\�(B\u001d��5K�y�������:RI��f��ԛ\u001c���\\��ꙒS�\t��7$$��3~\u001bro��ă�\u0010l\u0019��\\�a�߸/�՝r��5\u0006�l���C\u0001]9���W\u0006`kZ\u0017l�p�^::tEf���_x�rv��k\u0012X�ohU��g*}(]����a����V����y���l�!\u001b�.o�U���\u0015���b��\u0018�x��w�z��眬ϱ�q���~��B�\n=<��\u000f�\u00051E�GФ]�>\u0014��pn5�q\u0015�\u0012\u0015\u001c5���U�+��\u0011�\u0016�#��\u000f�\u0005�D�8̼�N�j̱�zm�F(5YcQ\u001f)Z�o�z2��1���?�\u001f\'Tp\u001c\u0000\u0000' 

```