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
🌐
Python.org
discuss.python.org › core development
Vote: New function for reading JSON from path - Core Development - Discussions on Python.org
March 10, 2021 - We have discussed about new function in the json module, but we didn’t make decision about its naming. Previous discussion: Mailman 3 A shortcut to load a JSON file into a dict : json.loadf - Python-ideas - python.org Issue: Issue 43457: Include simple file loading and saving functions in ...
Discussions

Appending JSON to same file
Hi, I need to make that within each request from api new dict will be appended to json. Now I have that each time data overwritten, but I need to append to existing file. How to achieve this? Code:(import requestsimport jsonimport timeimport csvimport pandas start=2 - Pastebin.com) More on discuss.python.org
🌐 discuss.python.org
0
January 5, 2023
Python newbie... Creating multiple json files from a single json file based on *some* value...
It only contains the last item You aren't collating your data in python. You have a list of dictionaries, and overwrite (or append) the file for each dictionary in the list, based on TeamID. But what you *want* is a dict of lists-of-dictionaries (probably), with each list-of-dictionaries each having the same TeamID entries: import json from collections import defaultdict jsonFilePath="new.json" with open(jsonFilePath, encoding='utf-8') as jsonFile: jsonData=json.load(jsonFile) # Collate dictionaries with the same TeamID into new lists. collated_teamids = defaultdict(list) for team in jsonData: # for each team, add to the list of team data collated_teamids[team['TeamID']].append(team) for team_id, teams in collated_teamids.items(): filename = "teams/" + str(team_id) + ".json" print(filename) with open(filename, 'w', encoding='utf-8') as outputFile: outputFile.write(json.dumps(teams, ensure_ascii=False, indent=2)) Note that I'm using a defaultdict(list) here to make it easy to just append each new 'team' dictionary (what you called row). But a regular dict is almost as easy, if you use the Python dict.get or dict.setdefault methods (or just test for the key first and create a new list). You definitely don't want to be appending to json files; they are structured data, and can't reliably be concatenated. Assemble the data first, and then write it all at once (as above). I don't make an effort to sort each team file by player ID, but that could be done by sorting the 'teams' variable that is retrieved by iterating over the collated_teamids. More on reddit.com
🌐 r/learnpython
6
2
January 5, 2019
Looking for a PyQt5 example to put a Json file into a treeview model item
First off I'd recommend posting in r/learnpython as you might get a few more replies over there. Second, you may consider breaking the problem in two. The are numerous ways to load Jason data into Python, with loading to a dict most likely the easiest. Thus you may find it easier to focus on how to translate the JSON data structure into your tree view items as the loading of the JSON shouldn't be difficult nor does it directly relate to PyQt. More on reddit.com
🌐 r/Python
4
2
September 7, 2016
One Horse Sized JSON file or 1000 Duck Sized JSON files.
Just put it in a database like SQLite. More on reddit.com
🌐 r/Python
45
64
November 12, 2020
🌐
McNeel Forum
discourse.mcneel.com › grasshopper
How to read json file into grasshopper? - Grasshopper - McNeel Forum
April 23, 2024 - Hello Rhino forum, I’m trying to read a json file consisting of 1500 strings. though it seemslike a panel only can contain 1425 strings / index. Is there a way that i can somehow import / read a big json file into gras…
🌐
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
🌐
MSSQLTips
mssqltips.com › home › write and read json files with python
Write and Read JSON Files with Python
November 4, 2022 - A JSON file is language-independent; therefore, you do not need JavaScript to use JSON files, and you can process JSON files in other languages besides JavaScript, such as Python or T-SQL. The structure of JSON files is more compact than XML files. Therefore, JSON files can be sent over the internet and loaded faster than XML files. One typical JSON file use case is when a client computer requests information from a server, which is passed from the server computer via a JSON file to the client computer.
🌐
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 ...
🌐
Codereview
codereview.doctor › features › python › best-practice › read-json-file-json-load
Use json.load to read a JSON file best practice | codereview.doctor
If you ever wondered why json.loads ... very related. In fact, json.load is a wrapper around json.loads. It's a method provided out of the box by Python to simplify the task of reading JSON from file-like objects....
Find elsewhere
🌐
Python
docs.python.org › 3 › library › json.html
json — JSON encoder and decoder
2 weeks ago - Serialize obj as a JSON formatted stream to fp (a .write()-supporting file-like object) using this Python-to-JSON conversion table.
🌐
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).
🌐
iO Flood
ioflood.com › blog › read-json-file-python
How To Read JSON Files in Python | Guide (With Examples)
February 1, 2024 - We use the json.loads() function to parse this string into a Python object. The result is a Python dictionary that mirrors the nested structure of the original JSON data. This ability to parse JSON strings is incredibly powerful, as it allows ...
🌐
Codingem
codingem.com › home › reading a json file in python
Reading a JSON File in Python - Python Basics - codingem.com
October 21, 2022 - Reading a JSON File in Python happens by opening the file using the with statement, and then reading the JSON using the json.load method.
🌐
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.
🌐
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'] # }
🌐
Leapcell
leapcell.io › blog › how-to-read-json-in-python
How to Read JSON in Python | Leapcell
July 25, 2025 - Use json.loads() to parse JSON strings into Python objects. Use json.load() to read JSON data from a file.
🌐
Dadroit
dadroit.com › string-to-json
Online String to JSON Converter
To convert String to JSON, visit the tool address, input your String data —or load your String file— and the tool will display the corresponding JSON output in real time.
🌐
Dataquest
dataquest.io › blog › python-json-tutorial
Working with Large JSON Files in Python – Dataquest
December 14, 2024 - This method ensures that we can efficiently extract the column information from large JSON files without loading the entire file into memory. The items function in ijson returns a generator, so we use the list method to convert it into a Python list.
🌐
Python.org
discuss.python.org › python help
Appending JSON to same file - Python Help - Discussions on Python.org
January 5, 2023 - Hi, I need to make that within each request from api new dict will be appended to json. Now I have that each time data overwritten, but I need to append to existing file. How to achieve this? Code:(import requestsimpor…
🌐
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.
🌐
Bobdc
bobdc.com › blog › pythonjson
Parsing JSON with Python
December 15, 2024 - Maybe the JSON came in JSON files, or maybe I retrieved it from an API. The duration between each of these occasions is long enough that I’ve had to relearn some basics each time, so a year or two ago I made a sample JSON file that demonstrates a few data structures and features, and then I wrote a Python demo script that parses them.
🌐
DataCamp
datacamp.com › tutorial › json-data-python
Python JSON Data: A Guide With Examples | DataCamp
December 3, 2024 - Configuration Files. 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)