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
๐ŸŒ
Real Python
realpython.com โ€บ python-json
Working With JSON Data in Python โ€“ Real Python
August 20, 2025 - You can write JSON with Python by using the json.dump() function to serialize Python objects into a JSON file. ... You connect JSON with Python by using the json module to serialize Python objects into JSON and deserialize JSON data into Python ...
๐ŸŒ
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
๐ŸŒ
Zyte
zyte.com โ€บ home โ€บ blog โ€บ json parsing with python [practical guide]
JSON Parsing with Python [Practical Guide]
July 6, 2023 - To read JSON data, you can use the built-in json module (JSON Encoder and Decoder) in Python. The json module provides two methods, loads and load, that allow you to parse JSON strings and JSON files, respectively, to convert JSON into Python ...
๐ŸŒ
W3Schools
w3schools.com โ€บ python โ€บ python_json.asp
Python JSON
Python has a built-in package called json, which can be used to work with JSON data.
๐ŸŒ
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 - Using the open() inbuilt function in Python, we can read that file and assign the content to a variable. Here's how: with open('user.json') as user_file: file_contents = user_file.read() print(file_contents) # { # "name": "John", # "age": 50, ...
๐ŸŒ
Programiz
programiz.com โ€บ python-programming โ€บ json
Python JSON: Read, Write, Parse JSON (With Examples)
Here, we have used the open() function to read the json file. Then, the file is parsed using json.load() method which gives us a dictionary named data. If you do not know how to read and write files in Python, we recommend you to check Python File I/O.
Find elsewhere
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ python โ€บ python-program-to-extract-a-single-value-from-json-response
Python program to extract a single value from JSON response - GeeksforGeeks
July 23, 2025 - We will discuss how Python can be used to extract a value from a JSON response using API and JSON files. Initially, use the API Key variable to declare the base URL. Where the first currency needs to be converted with the second, ask the user to enter a currency name and save it in a variable. The base URL is combined with the final URL, which includes both currencies, to fetch the result. An API call is then sent. The data is obtained by accessing the JSON Data's "conversion rate" key, and the resulting conversion rate is then printed.
๐ŸŒ
Bobdc
bobdc.com โ€บ blog โ€บ pythonjson
Parsing JSON with Python
December 15, 2024 - My sample demo data to parse is pretty close to the test input that I used when I wrote about JSON2RDF: { "mydata": { "color": "red", "amount": 3, "arrayTest": [ "north", "south", "east", "escaped \"test\" string", "west" ], "boolTest": true, "nullTest": null, "addressBookEntry": { "givenName": "Richard", "familyName": "Mutt", "address": { "street": "1 Main St", "city": "Springfield", "zip": "10045" } } } } ... #!/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 ar
๐ŸŒ
Oxylabs
oxylabs.io โ€บ blog โ€บ python-parse-json
Reading & Parsing JSON Data With Python: Tutorial
To put it simply, extracting data from a JSON file in Python requires reading the file, parsing its contents using the JSON module, and storing the data in a dictionary or list. You can then access specific values using dictionary keys or list ...
๐ŸŒ
Python
docs.python.org โ€บ 3 โ€บ library โ€บ json.html
json โ€” JSON encoder and decoder
If the data being deserialized is not a valid JSON document, a JSONDecodeError will be raised. Changed in version 3.6: All parameters are now keyword-only. ... Return the Python representation of s (a str instance containing a JSON document). JSONDecodeError will be raised if the given JSON document is not valid. ... Decode a JSON document from s (a str beginning with a JSON document) and return a 2-tuple of the Python representation and the index in s where the document ended.
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ python โ€บ reading-and-writing-json-to-a-file-in-python
Reading and Writing JSON to a File in Python - GeeksforGeeks
Python offers two main ways to read JSON data: The JSON package has json.load() function that loads the JSON content from a JSON file into a dictionary.
Published ย  August 5, 2025
๐ŸŒ
Analytics Vidhya
analyticsvidhya.com โ€บ home โ€บ hereโ€™s how you can read json files in python
Here's How You Can Read JSON Files in Python
April 15, 2024 - Once you have read the JSON Document data in Python, you can perform various operations on it. Access specific data elements in the JSON file by navigating through the keys. ... Modify the JSON data by updating existing values or adding new key-value pairs. # Modifying JSON data data['age'] = 35 print(data) Extract specific information from the JSON in Python data based on your requirements.
๐ŸŒ
YouTube
youtube.com โ€บ automate with rakesh
Python JSON Parsing: A Step-by-Step Guide to Extract Data from JSON - YouTube
In this comprehensive tutorial, learn the ins and outs of Python JSON parsing. Dive into the world of data manipulation as we explore the essential technique...
Published ย  August 20, 2023
Views ย  19K
๐ŸŒ
TutorialsPoint
tutorialspoint.com โ€บ how-to-read-json-file-in-python
How to read JSON file in Python
Suppose we have json file named "persons.json" with contents as shown in Example 2 above. We want to open and read it using python. This can be done in following steps ? ... Read the json file using load() and put the json data into a variable. Use the data retrieved from the file or simply ...
๐ŸŒ
Python Forum
python-forum.io โ€บ thread-38302.html
Reading Data from JSON
Hello looking to see if anyone could help me out here. Ive been trying to figure this out but seem to keep getting stuck. Im not very advance in python however im learning new things each day and time I write or try to write something new... Long st...
๐ŸŒ
Bright Data
brightdata.com โ€บ faqs โ€บ json โ€บ extract-json-response-python
How to Extract Data from a JSON Response in Python?
April 17, 2025 - Use the requests library to make an HTTP request to the desired API endpoint. For example, letโ€™s fetch data from a sample API. Once you have the response, you can parse the JSON content using the json library. With the JSON data parsed into a Python dictionary, you can extract specific values.
๐ŸŒ
Python Guides
pythonguides.com โ€บ json-data-in-python
How To Get Values From A JSON Array In Python?
November 29, 2024 - Python provides various ways to iterate through an array and extract the desired information. One common approach to iterate through a JSON array is using a for loop. This allows you to access each object in the array one by one. Hereโ€™s an example: import json # Load JSON data from file with ...