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
We will be using Python’s json module, which offers several methods to work with JSON data. In particular, loads() and load() are used to read JSON from strings and files, respectively.
Published   September 15, 2025
🌐
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" } } } } I read and output it with this Python: #!/usr/bin/env python3 import json f = open('jsondemo.js') data = json.load(f) print(data["mydata"]["color"]) print(data["mydata"]["amount"]) # Pull s
🌐
Renovate Docs
docs.renovatebot.com › configuration-options
Configuration Options - Renovate Docs
We also recommend you prefer using JSONC within a .json file to using a .json5 file if you want to add comments. When Renovate runs on a repository, it tries to find the configuration files in the order listed above. Renovate stops the search after it finds the first match. Renovate always uses the config from the repository's default branch, even if that configuration specifies baseBranchPatterns. Renovate does not read/override the config from within each base branch if present.
🌐
Claude API Docs
platform.claude.com › docs › en › build-with-claude › structured-outputs
Structured outputs - Claude API Docs
Instead of writing raw JSON schemas, you can use familiar schema definition tools in your language: Python: Pydantic models with client.messages.parse()
🌐
Python
docs.python.org › 3 › library › json.html
json — JSON encoder and decoder
1 month ago - Deserialize fp to a Python object using the JSON-to-Python conversion table. ... fp (file-like object) – A .read()-supporting text file or binary file containing the JSON document to be deserialized.
🌐
EE-Vibes
eevibes.com › home › how to read json file using python?
How to read JSON file using Python?
December 22, 2021 - Create a file on your disk (name it: example.json). The python program below reads the json file and uses the values directly.
Find elsewhere
🌐
Apache Spark
spark.apache.org
Apache Spark™ - Unified Engine for large-scale data analytics
$ docker run -it --rm spark:python3 /opt/spark/bin/pyspark · df = spark.read.json("logs.json") df.where("age > 21").select("name.first").show() # Every record contains a label and feature vector df = spark.createDataFrame(data, ["label", "features"]) # Split the data into train/test datasets train_df, test_df = df.randomSplit([.80, .20], seed=42) # Set hyperparameters for the algorithm rf = RandomForestRegressor(numTrees=100) # Fit the model to the training data model = rf.fit(train_df) # Generate predictions on the test dataset.
🌐
OneUptime
oneuptime.com › home › blog › how to read and write json files in python
How to Read and Write JSON Files in Python
January 25, 2026 - Python's built-in json module makes it straightforward to parse JSON from files and strings, as well as serialize Python objects back to JSON. The simplest way to read a JSON file is with json.load():
🌐
Zyte
zyte.com › home › blog › json parsing with python [practical guide]
JSON Parsing with Python [Practical Guide]
July 6, 2023 - In this guide, we’ll explore the syntax and data types of JSON, as well as the Python libraries and methods used for parsing JSON data, including more advanced options like JMESPath and ChompJS, which are very useful for web scraping data. One of the most common tasks when working with JSON data is to read its contents.
🌐
WooCommerce
woocommerce.github.io › woocommerce-rest-api-docs
WooCommerce REST API Documentation - WP REST API v3
You can specify the callback using the ?_jsonp parameter for GET requests to have the response wrapped in a JSON function:
🌐
Coursera
coursera.org › browse › computer science › software development
Python for Everybody | Coursera
Retrieve data from websites and APIs using Python · Work with XML (eXtensible Markup Language) data · Category: JSONJSON · Category: Web ScrapingWeb Scraping · Category: Network ProtocolsNetwork Protocols · Category: Data ProcessingData Processing · Category: Python ProgrammingPython Programming ·
Rating: 4.8 ​ - ​ 280K votes
🌐
NetworkAcademy
networkacademy.io › learning path: ccna automation (200-901) ccnaauto › data formats and data models › parsing json with python
Parsing JSON with Python | NetworkAcademy.IO
with open('example.json') as f: data = json.load(f) The with statement is a python control-flow structure that simplifies the process of reading and closing the file. Note that we use the load method instead of loads because this is a file. Let's see what the loaded data looks like in Python: Note that the JSON object is loaded as dictionary in Python.
🌐
FastAPI
fastapi.tiangolo.com
FastAPI
Validation even for deeply nested JSON objects. Conversion of input data: coming from the network to Python data and types. Reading from:
🌐
jq
jqlang.org › manual
jq 1.8 Manual
This option passes a JSON-encoded value to the jq program as a predefined variable. If you run jq with --argjson foo 123, then $foo is available in the program and has the value 123.
🌐
DataCamp
datacamp.com › tutorial › json-data-python
Python JSON Data: A Guide With Examples | DataCamp
December 3, 2024 - JSON provides a simple and easy-to-read format for storing and retrieving configuration data. This can include settings for the application, such as the layout of a user interface or user preferences. IoT (Internet of Things). IoT devices often generate large amounts of data, which can be stored and transmitted between sensors and other devices more efficiently using JSON. python_obj = { "name": "John Doe", "age": 30, "email": "john.doe@example.com", "is_employee": True, "hobbies": [ "reading", "playing soccer", "traveling" ], "address": { "street": "123 Main Street", "city": "New York", "state": "NY", "zip": "10001" } } print(python_obj)
🌐
GitHub
github.com › docling-project › docling
GitHub - docling-project/docling: Get your documents ready for gen AI · GitHub
2 weeks ago - To convert individual documents with python, use convert(), for example:
Starred by 56.4K users
Forked by 3.8K users
Languages   Python
🌐
Altcademy
altcademy.com › blog › how-to-read-json-file-in-python
How to read json file in Python
June 13, 2023 - Import the json module: First, you need to import the json module, which is included in the Python standard library. ... Open the JSON file: To read a JSON file, you need to open the file in read mode ('r').
🌐
Medium
medium.com › how-to-program › how-to-read-json-file-in-python-6fa918c07301
How to read JSON file in Python - how-to-program - Medium
January 1, 2022 - import jsonclass JSONReader: def __init__(self, file_path: str): self.file_path = file_path def read(self): with open(self.book_path, 'r') as myfile: data = myfile.read() return json.loads(data)if __name__ == "__main__": reader = JSONReader("/tmp/a.json") print(reader.read())