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
🌐
JSON Schema Validator
jsonschemavalidator.net
JSON Schema Validator - Newtonsoft
public class JsonSchemaController : ControllerBase { [HttpPost] [Route("api/jsonschema/validate")] public ValidateResponse Validate(ValidateRequest request) { // Load schema JSchema schema = JSchema.Parse(request.Schema); JToken json = JToken.Parse(request.Json); // Validate json IList<ValidationError> errors; bool valid = json.IsValid(schema, out errors); // Return error messages and line info to the browser return new ValidateResponse { Valid = valid, Errors = errors }; } } public class ValidateRequest { public string Json { get; set; } public string Schema { get; set; } } public class ValidateResponse { public bool Valid { get; set; } public IList<ValidationError> Errors { get; set; } }
Discussions

I try to load json file then filter some data, but I failed to load it even
Hello everyone, I’m new in learning programming, python, and in this forum as well. I want to load one json file in VS Code and get some data from it to use it in excel. But it just fails to load at the beginning when I write. I wrote this code to view json file. import json with ... More on discuss.python.org
🌐 discuss.python.org
0
0
July 18, 2022
Python read JSON file and modify - Stack Overflow
Hi I am trying to take the data from a json file and insert and id then perform POST REST. my file data.json has: { 'name':'myname' } and I would like to add an id so that the json data looks ... More on stackoverflow.com
🌐 stackoverflow.com
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
import json files directly in your python scripts
Looks like a novelty feature, I just can't see any useful real world implementation of this. But I'd be glad to get some examples. Since the json file would be statically named why not just use json.load and have one less 3rd party dependency. More on reddit.com
🌐 r/Python
51
99
June 10, 2021
🌐
AskPython
askpython.com › home › how to read a json file in python
How to Read a JSON File in Python - AskPython
July 7, 2022 - The json module is a built-in module in Python3, which provides us with JSON file handling capabilities using json.load().
🌐
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)¶
Find elsewhere
🌐
freeCodeCamp
freecodecamp.org › news › python-read-json-file-how-to-load-json-from-a-file-and-parse-dumps
Python Read JSON File – How to Load JSON from a File and Parse Dumps
October 27, 2020 - This is a variable that we can use within the with statement to refer to the file object. ... json.load(file) creates and returns a new Python dictionary with the key-value pairs in the JSON file.
🌐
Oreate AI
oreateai.com › blog › understanding-jsonload-vs-jsonloads-in-python › 90ebefc58481fbca189962dece43d86a
Understanding json.load vs. json.loads in Python - Oreate AI Blog
January 15, 2026 - Imagine you have a file named 'data.json' that contains structured JSON information—perhaps user details or configuration settings. To access this data, you would open the file and pass it to json.load, which then parses the content into a corresponding Python object (like a dictionary).
🌐
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.
🌐
Python.org
discuss.python.org › python help
I try to load json file then filter some data, but I failed to load it even - Python Help - Discussions on Python.org
July 18, 2022 - Hello everyone, I’m new in learning programming, python, and in this forum as well. I want to load one json file in VS Code and get some data from it to use it in excel. But it just fails to load at the beginning when I write. I wrote this code to view json file. import json with open("18july.json") as f: jsondata = json.load(f) print(jsondata) when I run py file, it wrote in terminal PS C:\Users\monst\Downloads\python files> & C:/Users/monst/AppData/Local/Programs/Python/Python310/pyth...
🌐
Leapcell
leapcell.io › blog › how-to-read-json-in-python
How to Read JSON in Python | Leapcell
July 25, 2025 - JSON is a lightweight data-interchange ... web APIs and configuration files. ... Python’s json.loads() method can parse a JSON-formatted string and convert it into a Python ......
🌐
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.
🌐
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.
🌐
GeeksforGeeks
geeksforgeeks.org › python › json-load-in-python
json.load() in Python - GeeksforGeeks
August 11, 2025 - import json # Opening and reading the JSON file with open('data.json', 'r') as f: # Parsing the JSON file into a Python dictionary data = json.load(f) # Iterating over employee details for emp in data['emp_details']: print(emp)
🌐
JSON Formatter
jsonformatter.org › json-viewer
JSON Viewer Online Best and Free
Read JSON File Using Python · Validate JSON using PHP · 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 ...
🌐
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.
🌐
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 - import json # Open the file and parse JSON content with open('config.json', 'r') as file: data = json.load(file) # Now data is a Python dictionary (or list, depending on JSON structure) print(data) print(type(data)) # <class 'dict'>
🌐
PythonHow
pythonhow.com › how › load-json-data-in-python
Here is how to load JSON data in Python
import json # Load JSON data from a file with open('employees.json', 'r') as file: employees = json.load(file) # Access and print employee details for employee in employees: print(f"Name: {employee['name']}, Age: {employee['age']}, Department: {employee['department']}, Title: {employee['title']}") ...