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
... import json try: with open('data.json', 'r') as file: data = json.load(file) print("File data =", data) except FileNotFoundError: print("Error: The file 'data.json' was not found.")
Published   September 15, 2025
🌐
ScriptCrunch
scriptcrunch.com › parse-json-file-using-python
How To Parse JSON File Content Using Python
September 25, 2025 - json = json.loads(open('/path/to/file.json').read()) To get a value from the JSON file, all you need to use the key with json keyword. For example, country from the example JSON file.
Discussions

python - Loading and parsing a JSON file with multiple JSON objects - Stack Overflow
I am trying to load and parse a JSON file in Python. But I'm stuck trying to load the file: import json json_data = open('file') data = json.load(json_data) Yields: ValueError: Extra data: line 2 More on stackoverflow.com
🌐 stackoverflow.com
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
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
json.decoder.JSONDecodeError: Extra data ||| While trying to read .json file
Well, your file, technically, isn't a valid JSON. But it is many JSON fragments strung together. If you have no control over the format this is written, then you could extract the position information from the error you are getting and use it to slice the string you are parsing in such a way that you only read a fragment at a time. This means that you will parse every piece of JSON twice, but, hopefully, this is a small price to pay. If this needs to be fast... then, write your own parser, in C or something that can be made fast... More on reddit.com
🌐 r/learnpython
15
11
January 16, 2021
People also ask

Where can I specify the file path when using 'json.dump()' in Python to write JSON data?
You specify the file path as the second argument when using 'json.dump()'. State it like this: 'json.dump(data, file_object)'.
🌐
upgrad.com
upgrad.com › home › tutorials › software & tech › how to open json file in python
Opening JSON Files in Python: A Step-by-Step Guide
How can I write a JSON file in Python?
You can write a JSON file in Python using the 'json.dump()' method. You can also employ the 'json.dumps()' function to serialize Python data into JSON format.
🌐
upgrad.com
upgrad.com › home › tutorials › software & tech › how to open json file in python
Opening JSON Files in Python: A Step-by-Step Guide
How do I read a JSON file in Python using Pandas?
You can read a JSON file in Python using Pandas with the 'pd.read_json()' function. Through this, the path to the JSON file we want to read is passed on.
🌐
upgrad.com
upgrad.com › home › tutorials › software & tech › how to open json file in python
Opening JSON Files in Python: A Step-by-Step Guide
🌐
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 - How can you read JSON data from a file into a Python program?Show/Hide · You can use the json.load() function to deserialize JSON data from a file into a Python object.
🌐
Medium
medium.com › @ryan_forrester_ › save-and-load-json-files-in-python-a-complete-guide-49a5760b8b49
Save and Load JSON Files in Python: A Complete Guide | by ryan | Medium
October 28, 2024 - - `open()` creates a file in write mode (“w”) - `json.dump()` writes the data directly to the file - The `with` statement ensures the file closes properly - Python handles the JSON conversion automatically ...
🌐
Upgrad
upgrad.com › home › tutorials › software & tech › how to open json file in python
Opening JSON Files in Python: A Step-by-Step Guide
December 4, 2024 - You can now access and use the data stored in the 'parsed_data' variable, which contains the contents of the JSON file as Python data structures (dictionaries, lists, strings, etc.). ... In this example, Python’s 'json.loads()' function is used ...
🌐
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 json module allows you to easily load a JSON file into its equivalent Python object (usually a dict or list). To load your data from a JSON file, use json.load(file_object).
🌐
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.
🌐
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?

🌐
Python
docs.python.org › 3 › library › json.html
json — JSON encoder and decoder
3 weeks ago - fp can now be a binary file. The input encoding should be UTF-8, UTF-16 or UTF-32. Changed in version 3.11: The default parse_int of int() now limits the maximum length of the integer string via the interpreter’s integer string conversion length limitation to help avoid denial of service attacks. json.loads(s, *, cls=None, object_hook=None, parse_float=None, parse_int=None, parse_constant=None, object_pairs_hook=None, **kw)¶
🌐
Reddit
reddit.com › r/python › handling json files with ease in python
r/Python on Reddit: Handling JSON files with ease in Python
May 29, 2022 -

I have finished writing the third article in the Data Engineering with Python series. This is about working with JSON data in Python. I have tried to cover every necessary use case. If you have any other suggestions, let me know.

Working with JSON in Python
Data Engineering with Python series

🌐
Scaler
scaler.com › home › topics › read, write, parse json file using python
Read, Write, Parse JSON File Using Python - Scaler Topics
April 17, 2024 - Load the JSON file into a file object and use the json.load() function to deserialize it into a Python dictionary.
🌐
PythonHow
pythonhow.com › how › load-json-data-in-python
Here is how to load JSON data in Python
with open('employees.json', 'r') as file: employees = json.load(file) ... Once the JSON data is loaded, it is converted into a Python list of dictionaries, allowing you to access and manipulate the data easily. for employee in employees: print(f"Name: {employee['name']}, Age: {employee['age']}, ...
🌐
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.
🌐
DataCamp
datacamp.com › tutorial › json-data-python
Python JSON Data: A Guide With Examples | DataCamp
December 3, 2024 - This function is used to read a JSON file and parse its contents into a Python object. The load() function takes a single argument, the file object, and returns a Python object.
🌐
Seaborn Line Plots
marsja.se › home › programming › python › how to read and write json files using python and pandas
How to Read and Write JSON Files using Python and Pandas - Erik Marsja
September 10, 2024 - In the first part, we are going to use the Python package json to create and read a JSON file as well as write a JSON file. After that, we are going to use Pandas read_json method to load JSON files into a Pandas dataframe. Here, we will learn ...