Fetch JSON output from HTTP link withoud .json extension

I am working on a project which involves geocoding.
Now I would like to use the JSON output of a link.
Unfortunately, when I try to log the output in the terminal, it just prints the link itself.

This is my code:


Thanks in advance.

You could use fetch to access the data.

(post deleted by author)

(post deleted by author)

That wouldn’t resolve my issue as the HTTP link would still have to end in .json.

That wouldn’t resolve my issue as the HTTP link would still have to end in dot json.

Do you want to access the data available in the link you provided? If the answer is yes, then you can use fetch. Otherwise, I do not understand what you are wanting to do here.

The link does not need to end in .json to access it. The data retrieved is in JSON format. That is all that matters.

Sorry for not being descriptive enough.
What I meant was that even simple fetch requests like these don’t work:

        .then(response => response.json())
        .then(json => console.log(json))

The code you wrote above works for me. Do you see any error messages in the browser console? If I change the console.log(json) to console.log(JSON.stringify(json, null, 2), then I see the following in the browser console:

    "place_id": 205120736,
    "licence": "Data © OpenStreetMap contributors, ODbL 1.0. https://osm.org/copyright",
    "osm_type": "way",
    "osm_id": 437595031,
    "boundingbox": [
    "lat": "52.54274275",
    "lon": "13.36690305710228",
    "display_name": "Ditsch, Lindower Straße, Sprengelkiez, Wedding, Mitte, Berlin, 13347, Germany",
    "class": "shop",
    "type": "bakery",
    "importance": 0.30010000000000003,
    "icon": "https://nominatim.openstreetmap.org/ui/mapicons/shopping_bakery.p.20.png",
    "address": {
      "shop": "Ditsch",
      "road": "Lindower Straße",
      "neighbourhood": "Sprengelkiez",
      "suburb": "Wedding",
      "borough": "Mitte",
      "city": "Berlin",
      "ISO3166-2-lvl4": "DE-BE",
      "postcode": "13347",
      "country": "Germany",
      "country_code": "de"

I just figures out what the problem was. I requested too many requests at once and further requests from my IP got baned for a short time period.