You have a JSON Lines format text file. You need to parse your file line by line:

import json

data = []
with open('file') as f:
    for line in f:
        data.append(json.loads(line))

Each line contains valid JSON, but as a whole, it is not a valid JSON value as there is no top-level list or object definition.

Note that because the file contains JSON per line, you are saved the headaches of trying to parse it all in one go or to figure out a streaming JSON parser. You can now opt to process each line separately before moving on to the next, saving memory in the process. You probably don't want to append each result to one list and then process everything if your file is really big.

If you have a file containing individual JSON objects with delimiters in-between, use How do I use the 'json' module to read in one JSON object at a time? to parse out individual objects using a buffered method.

Answer from Martijn Pieters on Stack Overflow
🌐
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
python - Reading JSON from a file - Stack Overflow
If you have to parse the file, then .read would be a bad way of doing it, since you'll have to reimplement what the json module already does. 2021-03-20T01:20:38.82Z+00:00 ... I think LOAD will reimplement the JSON with python dictionary but READ helps to load the JSON directly to the data ... More on stackoverflow.com
🌐 stackoverflow.com
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
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
🌐
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
🌐
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 ...
🌐
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?

Find elsewhere
🌐
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).
🌐
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

🌐
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.
🌐
Python
docs.python.org › 3 › library › json.html
json — JSON encoder and decoder
2 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)¶
🌐
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 ...
🌐
Squash
squash.io › how-to-read-json-from-a-file-in-python
How To Read JSON From a File In Python
3. Read the JSON data: Use the json.load() function to read the JSON data from the file. This function parses the JSON data and returns a Python dictionary or list, depending on the structure of the JSON.
🌐
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'] # }
🌐
GeeksforGeeks
geeksforgeeks.org › python › reading-and-writing-json-to-a-file-in-python
Reading and Writing JSON to a File in Python - GeeksforGeeks
This process is called deserialization. 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
🌐
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.
🌐
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.