Iterate over the file, loading each line as JSON in the loop:

tweets = []
with open('tweets.json', 'r') as file:
    for line in file:
        tweets.append(json.loads(line))

This avoids storing intermediate python objects. As long as you write one full tweet per append() call, this should work.

Answer from Adam Hughes on Stack Overflow
Discussions

json.decoder.JSONDecodeError: Extra data: line 1 column 300 (char 299)
Translating anything fails with exception "json.decoder.JSONDecodeError: Extra data: line 1 column 300 (char 299)" More on github.com
🌐 github.com
28
March 24, 2021
[Bug]: JSONDecodeError: Extra data: line 1 column 4 (char 3) on download_llama_dataset for PaulGrahamEssay
Bug Description Bug I had a public notebook that i created for public rag benchmarking. it was working perfectly fine with v0.10.11 but now i am getting on download_llama_dataset JSONDecodeError: E... More on github.com
🌐 github.com
1
April 25, 2024
python - json.decoder.JSONDecodeError: Extra data: line 1 column 5 (char 4) AND raise JSONDecodeError("Extra data", s, end) - Stack Overflow
I'm working on a stock market analysis app using the yahoo finance api on rapidapi. I successfully pull the data from the api using requests and the result is a requests.model.response. I found tha... More on stackoverflow.com
🌐 stackoverflow.com
Error Report: json.decoder.JSONDecodeError: Extra data: line 1 column 47 (char 46)
Conversation History USER: hi ASSISTANT: HelloHello! How can I help you today? USER: Can you analyze your tools ASSISTANT: II am a large language model, and I have access to the following tools: ba... More on github.com
🌐 github.com
1
March 4, 2025
🌐
Reddit
reddit.com › r/learnpython › json.decoder.jsondecodeerror: extra data: line 2 column 1 (char 212)
r/learnpython on Reddit: json.decoder.JSONDecodeError: Extra data: line 2 column 1 (char 212)
March 12, 2024 -

Hi, I have an assignment for class that I need to do, and I'm not asking for people to do it for me. But simply loading the JSON file into python using elasticsearch goes wrong for me. I get the following error: "json.decoder.JSONDecodeError: Extra data: line 2 column 1 (char 212)". When using the code: import json
from elasticsearch import Elasticsearch
es = Elasticsearch([{'host': 'localhost', 'port': 9200, 'scheme': 'http'}])
index_name = 'car_data'
with open("file_path", 'r' ) as file:
data = json.load(file)

Where "file_path" cointains a real file path.

I'm still totally new to coding so forgive me if I make very basic mistakes. Can anyone help me? If you need additional information that is also fine. I thought of looking at line 2 column 1 but couldn't find anything.

🌐
GitHub
github.com › lushan88a › google_trans_new › issues › 36
json.decoder.JSONDecodeError: Extra data: line 1 column 300 (char 299) · Issue #36 · lushan88a/google_trans_new
March 24, 2021 - Translating anything fails with exception "json.decoder.JSONDecodeError: Extra data: line 1 column 300 (char 299)"
Author   njlester
🌐
GitHub
github.com › run-llama › llama_index › issues › 13114
[Bug]: JSONDecodeError: Extra data: line 1 column 4 (char 3) on download_llama_dataset for PaulGrahamEssay · Issue #13114 · run-llama/llama_index
April 25, 2024 - Bug Description Bug I had a public notebook that i created for public rag benchmarking. it was working perfectly fine with v0.10.11 but now i am getting on download_llama_dataset JSONDecodeError: Extra data: line 1 column 4 (char 3) Exac...
Author   authentichamza
🌐
Bobby Hadz
bobbyhadz.com › blog › python-jsondecodeerror-extra-data
json.decoder.JSONDecodeError: Extra data in Python [Solved] | bobbyhadz
April 8, 2024 - Copied!import json # ⛔️ json.decoder.JSONDecodeError: Extra data: line 1 column 10 (char 9) result = json.loads(r'{"id": 1}{"id": 2}')
🌐
GitHub
github.com › openinterpreter › open-interpreter › issues › 1598
Error Report: json.decoder.JSONDecodeError: Extra data: line 1 column 47 (char 46) · Issue #1598 · openinterpreter/open-interpreter
March 4, 2025 - Traceback (most recent call last): File "C:\open-interpreter\interpreter\interpreter.py", line 1013, in async_chat async for _ in self.async_respond(user_input): File "C:\open-interpreter\interpreter\interpreter.py", line 884, in async_respond function_arguments = json.loads(tool_call.function.arguments) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\sturg\AppData\Roaming\uv\python\cpython-3.11.11-windows-x86_64-none\Lib\json_init_.py", line 346, in loads return _default_decoder.decode(s) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\sturg\AppData\Roaming\uv\python\cpython-3.11.11-windows-x86_64-none\Lib\json\decoder.py", line 340, in decode raise JSONDecodeError("Extra data", s, end) json.decoder.JSONDecodeError: Extra data: line 1 column 47 (char 46) OS: Windows Python: 3.11.11 (main, Jan 14 2025, 22:46:06) [MSC v.1942 64 bit (AMD64)] Reactions are currently unavailable ·
Author   jamsturg
Find elsewhere
🌐
GitHub
github.com › chroma-core › chroma › issues › 3545
[Bug]: JSONDecodeError("Extra data", s, end) on embedding_functions.OllamaEmbeddingFunction · Issue #3545 · chroma-core/chroma
December 13, 2024 - Hi, I'm using this piece of code to create text embeddings and I get JSONDecodeError when I pass variable _content_data_units that it is an array of strings. I tried to run it with small data array and it don't fails. Also I tested all models you see in the if, and the behaviour is the same, manually it works, with this code, don't.
Author   blackhold
🌐
Red Hat
access.redhat.com › solutions › 5248431
overcloud deployment failing with "json.decoder.JSONDecodeError: Extra data: line 1 column 7 (char 6)" - Red Hat Customer Portal
Processing templates in the directory /tmp/tripleoclient-8jpt8_jh/tripleo-heat-templates Action tripleo.parameters.update execution failed: Error validating environment for plan viper: ERROR: Internal Error Traceback (most recent call last): File "/usr/lib/python3.6/site-packages/heat/engine/parameters.py", line 455, in parse return jsonutils.loads(val) File "/usr/lib/python3.6/site-packages/oslo_serialization/jsonutils.py", line 264, in loads return json.loads(encodeutils.safe_decode(s, encoding), **kwargs) File "/usr/lib64/python3.6/json/__init__.py", line 354, in loads return _default_decod
🌐
GitHub
github.com › ArchiveBox › ArchiveBox › issues › 1347
Bug: `JSONDecodeError` when trying to load JSON with an array at the top-level · Issue #1347 · ArchiveBox/ArchiveBox
February 15, 2024 - File "/tmp/archivebox/venv/lib... "/usr/lib/python3.11/json/decoder.py", line 340, in decode raise JSONDecodeError("Extra data", s, end) json.decoder.JSONDecodeError: Extra data: line 1 column 61 (char 60)...
Author   philippemilink
🌐
Medium
medium.com › bugs-that-bite › json-decoder-jsondecodeerror-extra-data-line-14-column-945-char-5957-7e65c1366b56
json.decoder.JSONDecodeError: Extra data: line 14 column 945 (char 5957) | by Teri Radichel | Bugs That Bite | Medium
February 13, 2024 - In my particular case I got this error because I had been concatenating two different json files into one array of items. Then I started testing just one of the files and forgot to add the extra element indicating the list name for the list of dictionaries I was parsing.
🌐
GitHub
github.com › microsoft › semantic-kernel › issues › 1930
Python: json.decoder.JSONDecodeError: Extra data: line 7 column 1 (char 125) · Issue #1930 · microsoft/semantic-kernel
April 10, 2023 - Describe the bug A clear and concise description of what the bug is. When running the sample python hello world we get: json.decoder.JSONDecodeError: Extra data: line 7 column 1 (char 125) Exception has occurred: JSONDecodeError Extra da...
Author   ewitkon
🌐
sebhastian
sebhastian.com › python-jsondecodeerror-extra-data
Python json.decoder.JSONDecodeError: Extra data | sebhastian
January 30, 2023 - import json data = [json.loads(line) ... shows json.decoder.JSONDecodeError: Extra data error message when you try to load JSON data with an invalid format....
🌐
Kaggle
kaggle.com › questions-and-answers › 290373
error reading json from txt file in python
Checking your browser before accessing www.kaggle.com · Click here if you are not automatically redirected after 5 seconds
🌐
Python.org
discuss.python.org › python help
Hello, i need help with the code. I need read code of JSON, but I have a problem - Python Help - Discussions on Python.org
December 16, 2023 - with open(‘new_york_times.json’,mode=“+r”,encoding=“UTF-8”) as contenido: set_datos = json.load(contenido) df = pd.DataFrame.from_dict(set_datos) But i get this error: Traceback (most recent call last): File “c:\Users\aquiroz\OneDrive - Unified Networks\Documentos\adi VS\jsob.py”, line 14, in set_datos = json.load(contenido) ^^^^^^^^^^^^^^^^^^^^ File “C:\Users\aquiroz\AppData\Local\Programs\Python\Python312\Lib\json_init_.py”, line 293, in load return loads(fp.read(), ^^^^^^^^^^^^^^^^ ...
🌐
GitHub
github.com › OmenWild › home-assistant-z-wave-graph › issues › 4
json.decoder.JSONDecodeError: Extra data: line 1 column 4 (char 3) · Issue #4 · OmenWild/home-assistant-z-wave-graph
January 28, 2018 - (homeassistant) raspberrypi% python3 ./bin/z-wave-graph.py Error fetching states Traceback (most recent call last): File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/remote.py", line 206, in get_states item in req.json()] File "/srv/homeassistant/lib/python3.5/site-packages/requests/models.py", line 892, in json return complexjson.loads(self.text, **kwargs) File "/usr/lib/python3.5/json/__init__.py", line 319, in loads return _default_decoder.decode(s) File "/usr/lib/python3.5/json/decoder.py", line 342, in decode raise JSONDecodeError("Extra data", s, end) json.decoder.JSONDecodeError: Extra data: line 1 column 4 (char 3) No one assigned ·
🌐
GitHub
github.com › elastic › elasticsearch-py › issues › 967
JSONDecodeError('Extra data: line 1 column ... · Issue #967 · elastic/elasticsearch-py
June 4, 2019 - Elastic search python client is version 6.3.1 I have a gunicorne flask app with 4 workers. I use gevents to search multiple indices in 'parallel'. From time to time, I get the JSONDecodeError('Extra data: line 1 column 98726 (char 98725)',)) error while pulling data from Elasticsearch.
Author   neo-logic