First of all, it depends on what operating system you're using.

On Windows

If you right click and press "save" (Alternatively use ctrl-s) and then chose the file format "json" when saving.

On macOS

You can do this in a few ways, I'd suggest using curl. You'd do this by opening the terminal and navigating to the directory you'd like to download the file to. Then enter the following:

curl https://somedomain.com/somepath.json > fileName.json

This will download the file in its original format.

Answer from Maximilian on Stack Overflow
🌐
Reddit
reddit.com › r/data › good easy way to download json from the web?
r/data on Reddit: Good easy way to download JSON from the web?
July 20, 2022 -

So I've got a JSON file I want to download from a website.

The data comes in a URL that ends with a 6 digit ID number (unfortunately I cannot find a logic to the ID but it's not a single increment system, so I'd like to be able to check like the next 10,000 ID's say once a week).

I'd then like to pull parts of the JSON files into some kind of spreadsheet (dumping to a CSV is fine). There is a lot of data I don't need/want in these files. I know how to pull the data into excel but I feel like there will be a better way to do this automagically.

🌐
n8n
community.n8n.io › questions
Download image from Url(s) in a Json File - Questions - n8n Community
August 26, 2022 - I am new here and have problems to read all URL’s from a JSON file. You can find my workflow here. Maybe there is someone who can help me? I create a HTTP request to the JSON file. In another request I say that I want to get the “coverImgUrl” as a file, so I can read it as a URL and copy ...
🌐
CodeSandbox
codesandbox.io › s › download-json-file-with-js-p9t1z
download json file with Js - CodeSandbox
January 30, 2020 - download json file with Js by hieuht2048
Published   May 20, 2019
Author   hieuht2048
🌐
GitHub
gist.github.com › petermeissner › c15f178711266405528ed751cf0cb5fb
Download JSON file from webpage · GitHub
Learn more about clone URLs · Clone this repository at <script src="https://gist.github.com/petermeissner/c15f178711266405528ed751cf0cb5fb.js"></script> Save petermeissner/c15f178711266405528ed751cf0cb5fb to your computer and use it in GitHub Desktop. Download ZIP · Download JSON file from webpage ·
🌐
JMP User Community
community.jmp.com › t5 › Discussions › How-to-parse-a-JSON-file-opened-from-URL › td-p › 44791
Solved: How to parse a JSON file opened from URL? - JMP User Community
September 28, 2017 - I would like to import a JSON file into JMP that is downloaded off of the web. The best way I've been able to do this is through the GUI, manually selecting File --> Open --> and entering the URL into "File Name".
🌐
Hacking with Swift
hackingwithswift.com › quick-start › concurrency › how-to-download-json-from-the-internet-and-decode-it-into-any-codable-type
How to download JSON from the internet and decode it into any Codable type - a free Swift Concurrency by Example tutorial
November 12, 2024 - let messages: [Message] = try await URLSession.shared.decode(from: url2) print("Downloaded \(messages.count) messages") // Create a custom URLSession and decode a Double array from that let config = URLSessionConfiguration.default config.requestCachePolicy = .reloadIgnoringLocalAndRemoteCacheData let session = URLSession(configuration: config) let url3 = URL(string: "https://hws.dev/readings.json")!
Find elsewhere
🌐
MyCleverAI
mycleverai.com › it-questions › how-can-i-download-a-json-file-from-a-link
How can I download a JSON file from a link?
import requests import json url = "https://example.com/data.json" response = requests.get(url) if response.status_code == 200: data = response.json() with open("data.json", "w") as f: json.dump(data, f, indent=2) print("JSON file downloaded successfully!") else: print(f"Failed to download, ...
🌐
Reddit
reddit.com › r/learnpython › trouble downloading json files from a url
r/learnpython on Reddit: Trouble downloading JSON files from a URL
April 19, 2022 -

I'm trying to download JSON files from a URL. When I've attempted to open the saved JSON files in python, I get the error:

"raise JSONDecodeError("Expecting value", s, err.value) from None".

Whenever I try opening the JSON files in a URL, I see this:

"SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data"

Below is a simplified version of my code. Is there a way to download JSON files correctly?

def read_url(url):

    urls = []
    psfiles = []
    
    url = url.replace(" ","%20")
    req = Request(url)
    a = urlopen(req).read()
    soup = BeautifulSoup(a, 'html.parser')
    x = (soup.find_all('a'))
    for i in x:
        file_name = i.extract().get_text()
        url_new = url + file_name
        url_new = url_new.replace(" ","%20")
        if(file_name[-1]=='/' and file_name[0]!='.'):
            read_url(url_new)
        if url_new.endswith('json'):
            urls.append(url_new)
      
    for i in urls:
        psfile = i.replace('url','')
        psfiles.append(psfile)
 
         
    for j in range(len(psfiles)):
        urllib.request.urlretrieve("url", "path to directory"+psfiles[j])


if __name__ == '__main__':
    while True:
        read_url("url")
        time.sleep(1800)
Top answer
1 of 2
5
here's a code snippet with requests that works >>> import requests >>> >>> url = 'https://old.reddit.com/r/learnpython/comments/v02hmv/trouble_downloading_json_files_from_a_url.json' >>> >>> response = requests.get(url) >>> json_data = response.json() >>> print(json_data) some of the output: [{'kind': 'Listing', 'data': {'after': None, 'dist': 1, 'modhash': '', 'geo_filter': '', 'children': [{'kind': 't3', 'data': {'approved_at_utc': None, 'subreddit': 'learnpython', 'selftext': 'I\'m trying to download JSON files from a URL. When I\'ve attempted to open the saved JSON files in python, I get the error:\n\n"raise JSONDecodeError("Expecting value", s, err.value) from None".\n\nWhenever I try opening the JSON files in a URL, I see this:\n\n"SyntaxError: JSON.parse: [...] if that doesn't work at your URL it's probably not valid a json string in the response you're getting
2 of 2
2
Imho you should start by actively debugging the stages in your code. The prime place to start is to check what is actually downloaded, eg add html = urlopen(req).read() # avoid confusing names like 'a' with open("base.html", "w") as fp: fp.write(html) to check in an editor or browser if that's a functional webpage that includes your data. Then add prints to the data extracted in BS, so links = (soup.find_all('a')) # again, more useful name print("found", len(links), "urls") for link in links: # you see now it reads more like English than 'for i in x' file_name = link.extract().get_text() print("file_name", file_name) url_new = url + file_name url_new = url_new.replace(" ","%20") if(file_name[-1]=='/' and file_name[0]!='.'): print("calling read_url with", url_new) read_url(url_new) else: print("skipping read_url") # or whatever you would call this case if url_new.endswith('json'): print("appending", url_new) urls.append(url_new) else: print("not json", url_new) same for the rest. Then you can actually know what parts are working and if it behaves like you're expecting.
🌐
Valentino G.
valentinog.com › blog › link-download
JSON files download with the anchor download attribute
April 5, 2020 - As a last step let's apply our Data URL to the anchor element. Here's the complete code: const form = document.forms[0]; form.addEventListener("submit", function(event) { event.preventDefault(); buildJSON(this); }); function buildJSON(form) { const data = new FormData(form); const entries = data.entries(); const obj = Object.fromEntries(entries); const json = JSON.stringify(obj); const dataURL = `data:application/json,${json}`; const anchor = document.querySelector("a"); anchor.setAttribute("download", "Your_data.txt"); anchor.setAttribute("href", dataURL); }
🌐
Jameslmilner
jameslmilner.com › posts › downloading-a-file-with-javascript
Downloading Text, JSON and Images with clientside JavaScript
January 8, 2023 - // Turn the JSON object into a string const data = "Hello world"; // Pass the string to a Blob and turn it // into an ObjectURL const blob = new Blob([data], { type: "text/plain" }); const jsonObjectUrl = URL.createObjectURL(blob); // Create an anchor element, set it's // href to be the Object URL we have created // and set the download property to be the file name // we want to set const filename = "example.txt"; const anchorEl = document.createElement("a"); anchorEl.href = jsonObjectUrl; anchorEl.download = filename; // There is no need to actually attach the DOM // element but we do need to click on it anchor.click(); // We don't want to keep a reference to the file // any longer so we release it manually URL.revokeObjectURL(jsonObjectUrl);
🌐
URL to Any
urltoany.com › url-to-json
URL to JSON Converter - Free Online JSON Data Extractor
Copy or download your converted JSON data. Perfect for data extraction, API testing, and web scraping with JSON URL format. Website to JSON Converter: Our tool can convert any website to JSON format, extracting structured data from complex web pages for API integration.
🌐
GitHub
gist.github.com › ganezasan › 4fbdfff0bf828eca3c74
Download JSON File · GitHub
Learn more about clone URLs · Clone this repository at <script src="https://gist.github.com/ganezasan/4fbdfff0bf828eca3c74.js"></script> Save ganezasan/4fbdfff0bf828eca3c74 to your computer and use it in GitHub Desktop. Download ZIP · Download JSON File ·
🌐
Mozilla Discourse
discourse.mozilla.org › t › download-a-json-from-personnal-website › 12158
Download a .json from personnal website - addons.mozilla.org - Mozilla Discourse
November 22, 2016 - Hello ! 🙂 Some days ago, I submited an add-on named “Drive+” to review, the version I submited use a .json file included in the package. At the time i submited the add-on I didn’t knew how the whole verification system worked, so now I know, I’m thinking about making the file external.
🌐
UiPath Community
forum.uipath.com › help
Downloading JSON from Web and getting data to datable - Help - UiPath Community Forum
July 14, 2018 - Hi, I need to get JSON file from http address from web. Address returns JSON file. In file is a list of companys names and addresses. After that i need to get names to datable. I have no idea how to accomplish this, co…
🌐
European Medicines Agency
ema.europa.eu › home › about us › about this website › download website data in json data format
Download website data in JSON data format | European Medicines Agency (EMA)
November 19, 2025 - translations with ISO language code and corresponding URL: “translations”, ISO language code for example “bg” and its URL · Guidance and information JSON data file: Includes general pages published on the EMA website covering website sections not covered by other JSON data files.
🌐
You Should Know
revistasdemo.untumbes.edu.pe › how-to-download-json-data-from-a-url-a-comprehensive-guide
How to Download JSON Data from a URL: A Comprehensive Guide - untumbes.edu.pe
April 24, 2025 - The `-o` option specifies the output file name (`data.json` in this case), and `<JSON_URL>` is the URL of the JSON data. If the API requires authentication, you can include the necessary credentials using the `-u` option for basic authentication: ... `wget` is another popular command-line tool for downloading files from the web.