The json.load() method (without "s" in "load") can read a file directly:

import json

with open('strings.json') as f:
    d = json.load(f)
    print(d)

You were using the json.loads() method, which is used for string arguments only.


The error you get with json.loads is a totally different problem. In that case, there is some invalid JSON content in that file. For that, I would recommend running the file through a JSON validator.

There are also solutions for fixing JSON like for example How do I automatically fix an invalid JSON string?.

Answer from ubomb on Stack Overflow
🌐
GeeksforGeeks
geeksforgeeks.org › python › read-json-file-using-python
Read JSON file using Python - GeeksforGeeks
In particular, loads() and load() are used to read JSON from strings and files, respectively. json.dumps(obj, indent=4): converts the Python object back to a JSON string with 4-space indentation.
Published   September 15, 2025
Discussions

How do I open or even find a json file?
You store python objects in a file and retrieve the objects from a file using the json module. This tutorial shows you the basics, and you can search for other tutorials. The python doc is here . More on reddit.com
🌐 r/learnpython
23
0
June 26, 2024
How would you use python to create JSON files?
I read two concrete questions from your post: why you would want to create a JSON object Imagine you want multiple software systems to communicate. Let's say we have three systems, one written in Python, one client written in JavaScript and one more backend system in Java. You can't just send Python objects over a network and expect the systems written in JS or Java to understand them. Same thing the other way around. In the end it's just electrical signals and both the sender and receiver need a common understanding of how to interpret those signals, otherwise they will just be gibberish. That's where data formats like JSON come into play: It's a simple and standardized data format that can be handled in any modern programming language. Now your Python code can serialize its internal representation of a piece of data into this format and send it over a network or store it on some disk, where some other system will eventually pick it up, deserialize it into its own internal representation and process it. show how you would create a JSON object with python import json data = {"year": 2020, "sales": 12345678, "currency": "€"} # creating a JSON string json_string = json.dumps(data) # storing it in a file with open("data.json", "w") as json_file: json.dump(data, json_file) More on reddit.com
🌐 r/learnpython
7
5
March 7, 2020
Proper way to open and write json files?
You should try to minimize file opening/closing operations. In general, the syntax to follow is: with open(FILENAME, MODE) as FILE_DESCRIPTOR_ALIAS: # DO OPERATIONS HERE MODE will determine the kinds of and behavior of input-output actions you can perform with the file. See this fantastic thread on the matter . So the typical workflow is: open a file, read in its contents, modify said contents, save the modified contents back to the file. The typical mode used for this kind of workflow is r+ More on reddit.com
🌐 r/learnpython
4
1
November 18, 2021
Handling JSON files with ease in Python
Looks good. Considered discussing dataclasses/pydantic with json? I found that these go well together More on reddit.com
🌐 r/Python
55
421
May 29, 2022
🌐
Medium
medium.com › @jimitdoshi639 › parse-content-in-json-file-into-a-dictionary-in-python-a-fun-and-informative-guide-88c169561550
Parse content in JSON file into a dictionary in Python: A fun and informative guide | by Jimit Doshi | Medium
May 4, 2024 - Here, parsed_data will be a dictionary containing the contents of the JSON file. Accessing the Data: Now you can access the data in the dictionary as you would with any other dictionary in Python. ... Replace 'key' with the specific key you want to access in your JSON data. Putting it all together, here’s a complete example: ... # Open the JSON file with open('data.json', 'r') as file: data = file.read()# Parse JSON data into a dictionary parsed_data = json.loads(data)# Accessing the data print(parsed_data['key'])
🌐
Imperial College London
python.pages.doc.ic.ac.uk › java › lessons › java › 10-files › 03-load.html
Python for Java Programmers > Loading JSON files
The following code loads the content from a file called input.json into a Python object named data. You can then manipulate data as you would a list or dict (depending on what is in input.json) import json with open("input.json", "r") as jsonfile: data = json.load(jsonfile) print(type(data))
🌐
Reddit
reddit.com › r/learnpython › how do i open or even find a json file?
r/learnpython on Reddit: How do I open or even find a json file?
June 26, 2024 -

I'm making a text based rpg in python and i learnt that the data can be saved to a json file and then can be read from it and used. But how do I access that json file? Or maybe i should do another method to save game? Also is there a way to open a json file in python so that python can read it's values?

🌐
Bobdc
bobdc.com › blog › pythonjson
Parsing JSON with Python
December 15, 2024 - #!/usr/bin/env python3 import json f = open('jsondemo.js') data = json.load(f) print(data["mydata"]["color"]) print(data["mydata"]["amount"]) # Pull something out of the middle of an array print(data["mydata"]["arrayTest"][3]) print(data["mydata"]["boolTest"]) print(data["mydata"]["nullTest"]) # Use a boolean value if data["mydata"]["boolTest"]: print("So boolean!") # Dig down into a data structure print(data["mydata"]["addressBookEntry"]["address"]["city"]) print("-- mydata properties: --") for p in data["mydata"]: print(p) print("-- list addressBookEntry property names and values: --") for p in data["mydata"]["addressBookEntry"]: print(p + ': ' + str(data["mydata"]["addressBookEntry"][p])) # Testing whether values are present.
Find elsewhere
🌐
Real Python
realpython.com › python-json
Working With JSON Data in Python – Real Python
August 20, 2025 - In lines 3 to 22, you define a dog_data dictionary that you write to a JSON file in line 25 using a context manager. To properly indicate that the file contains JSON data, you set the file extension to .json. When you use open(), then it’s good practice to define the encoding.
🌐
DataCamp
datacamp.com › tutorial › json-data-python
Python JSON Data: A Guide With Examples | DataCamp
December 3, 2024 - For working with large JSON files that cannot fit in memory, you can process the data incrementally using Python’s ijson library or read the file line-by-line if the JSON is structured as a series of smaller objects. For example: import ijson with open('large_file.json', 'r') as file: for item in ijson.items(file, 'item'): print(item) # Process each JSON item individually
🌐
freeCodeCamp
freecodecamp.org › news › loading-a-json-file-in-python-how-to-read-and-parse-json
Loading a JSON File in Python – How to Read and Parse JSON
July 25, 2022 - This is because null is not valid in Python. The json module also has the load method which you can use to read a file object and parse it at the same time. Using this method, you can update the previous code to this: import json with open('user.json') as user_file: parsed_json = json.load(user_file) print(parsed_json) # { # 'name': 'John', # 'age': 50, # 'is_married': False, # 'profession': None, # 'hobbies': ['travelling', 'photography'] # }
🌐
HackerNoon
hackernoon.com › how-to-read-and-write-json-files-in-python
How to read and write JSON files in Python | HackerNoon
March 19, 2024 - We will discuss how to use Python to read, write, and manipulate JSON files.
🌐
Leapcell
leapcell.io › blog › how-to-read-json-in-python
How to Read JSON in Python | Leapcell
July 25, 2025 - Read and handle JSON data in Python using the `json` module.
🌐
W3Schools
w3schools.com › python › python_json.asp
Python JSON
JSON is text, written with JavaScript object notation. Python has a built-in package called json, which can be used to work with JSON data.
🌐
Scaler
scaler.com › home › topics › read, write, parse json file using python
Read, Write, Parse JSON File Using Python - Scaler Topics
April 17, 2024 - Let's consider an example where ... holds the data we want to write to the file. We open a file named user_data.json in write mode ('w')....
🌐
Plain English
python.plainenglish.io › how-to-read-json-files-in-python-aec189287cfe
How to Read JSON Files in Python. This article will cover how to read… | by Crawlbase | Python in Plain English
May 18, 2025 - In this code, We use open() function to open the file in read mode (‘r’) and then pass the file object to json.load() to read and parse the JSON into a Python dictionary.
🌐
AskPython
askpython.com › home › python read json file and modify
Python Read JSON File and Modify - AskPython
June 30, 2023 - Now that you’ve opened the text editor click on Create a file button in your text editor. Now you can choose any name for the file but just make sure you end the file name with the “.json” extension. So finally, your file name would look something like <filename>.json. Now just click enter and save the file. There you go, you have a JSON file right there. json is an in-built Python ...
🌐
Zyte
zyte.com › home › blog › json parsing with python [practical guide]
JSON Parsing with Python [Practical Guide]
July 6, 2023 - We load the data using the with open() context manager and json.load() to load the contents of the JSON file into a Python dictionary.
🌐
Python documentation
docs.python.org › 3 › tutorial › inputoutput.html
7. Input and Output — Python 3.14.3 documentation
Use encoding="utf-8" when opening JSON file as a text file for both of reading and writing.
🌐
JSON Formatter
jsonformatter.org › json-viewer
JSON Viewer Online Best and Free
Python Load Json From File · Best and Secure JSON Viewer works well in Windows, Mac, Linux, Chrome, Firefox, Safari and Edge. Step 1: Open JSON Viewer tool using this link JSON Viewer. Step 2: Click on Load Data, which will open a popup window.
🌐
W3Schools
w3schools.com › python › pandas › pandas_json.asp
Pandas Read JSON
In our examples we will be using a JSON file called 'data.json'. Open data.json. ... Tip: use to_string() to print the entire DataFrame. ... JSON objects have the same format as Python dictionaries.
🌐
Studytonight
studytonight.com › python-howtos › how-to-read-json-file-in-python
How to read JSON file in Python - Studytonight
In the above code to read the JSON file, first, we have imported the JSON module and then we have used the open() function to read the JSON file bypassing the JSON file path along with the name of the file as an argument.