Unexpected token: from a URL with .json extension

0

When trying to get a JSON via the URL: http://www.cidades.ibge.gov.br/gmap/shapes/35/MU_M13_3550308_1000.json

I get a status 200 with error:

Uncaught SyntaxError: Unexpected token :

Using AJAX as follows:

$(document).ready(function($) {
  $.ajax({
    type: "GET",
    url: "http://www.cidades.ibge.gov.br/gmap/shapes/35/MU_M13_3550308_1000.json",
    dataType: "jsonp",
    success: function(data) {
      console.log(data);
    },
    error: function(xhr, ajaxOptions, thrownError) {
      console.log(xhr.status);
      console.log(thrownError);
    }
  });
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>

What is the cause of the error?

    
asked by anonymous 25.05.2016 / 17:14

1 answer

1

The content of URL provided does not return a valid JSON. This is why you are having this error.

Apparently in the specific case of your problem , it appears that the quotation marks in the items keys are missing. What I would do would be to create an endpoint on an intermediate server that would download the original file, handle it and return the corrected file.

    
25.05.2016 / 17:21