If you update your file to contain a single JSON object, you can access the dictionaries within it using the json.load() function.

with open("file.json") as json_file:
    items = json.load(json_file)

    dict1 = items[0]
Answer from dev0717 on Stack Overflow
🌐
GeeksforGeeks
geeksforgeeks.org › python › convert-json-to-dictionary-in-python
Convert JSON to dictionary in Python - GeeksforGeeks
July 12, 2025 - In the below code, firstly we open the "data.json" file using file handling in Python and then convert the file to Python object using the json.load() method we have also print the type of data after conversion and print the dictionary.
🌐
Reddit
reddit.com › r/learnpython › convert json list to dictionary
r/learnpython on Reddit: convert JSON list to dictionary
January 13, 2024 -

I must first preface this with the fact that I’m extremely new to python. Like just started learning it a little over a week ago.
I have been racking my brain over how to convert a json object I opened and loaded into a dictionary from a list so I can use the get() function nested within a for loop to do a student ID comparison from another json file (key name in that file is just ID).
Below is the command I’m trying to load the json file:
With open(‘file.json’) as x: object=json.load(x)
When I print(type(object)), it shows up as class list.
Here’s a sample of what the json looks like:
[

{

“Name”: “Steel”,

“StudentID”: 3458274

“Tuition”: 24.99

},

{

“Name”: “Joe”,

“StudentID”: 5927592

“Tuition”: 14.99

}

]
HELP! Thank you!

Discussions

How can I access a specific dictionary in JSON file in python? - Stack Overflow
How would I access one of the two dictionaries later in my Python code? There are multiple dictionaries so I can't simply read the .json file to get one and only one dictionary. More on stackoverflow.com
🌐 stackoverflow.com
python - How can I import the first and only dict out of a top-level array in a json file? - Stack Overflow
I tried to think about how can ... way of importing the file already as a dict? ... Your data get's imported as list, because in your JSON file the main structure is an Array (squared brackets), which is comparable to a list in Python.... More on stackoverflow.com
🌐 stackoverflow.com
Correct way of loading JSON from file into a Python dictionary - Stack Overflow
Find the answer to your question by asking. Ask question ... See similar questions with these tags. ... I’m Jody, the Chief Product and Technology Officer at Stack Overflow. Let’s... 17 Why is json.loads an order of magnitude faster than ast.literal_eval? 9 reading text file back into a dictionary ... More on stackoverflow.com
🌐 stackoverflow.com
How to read a json file and return as dictionary in Python - Stack Overflow
Communities for your favorite technologies. Explore all Collectives · Stack Overflow for Teams is now called Stack Internal. Bring the best of human thought and AI automation together at your work More on stackoverflow.com
🌐 stackoverflow.com
🌐
Medium
medium.com › @jimitdoshi639 › parse-content-in-json-file-into-a-dictionary-in-python-a-fun-and-informative-guide-88c169561550
Parse content in JSON file into a dictionary in Python: A fun and informative guide | by Jimit Doshi | Medium
May 4, 2024 - Parse JSON Data: Use the json.loads() function to parse the JSON data from the file into a Python dictionary. ... Here, parsed_data will be a dictionary containing the contents of the JSON file.
Top answer
1 of 2
1

If you update your file to contain a single JSON object, you can access the dictionaries within it using the json.load() function.

with open("file.json") as json_file:
    items = json.load(json_file)

    dict1 = items[0]
2 of 2
0

You do not have a JSON file. You have a file that is a concatenation of multiple JSON documents. json.load cannot handle this; you have to go lower level with JSONDecoder.raw_decode. This code will load your file into a list:

import json

with open('file.json', 'rt') as r:
    raw_json = r.read()

decoder = json.JSONDecoder()
items = []
while raw_json:
    item, pos = decoder.raw_decode(raw_json)
    raw_json = raw_json[pos:].strip()
    items.append(item)

from pprint import pprint
pprint(items)

# => [{'Amazon': {'email': '[email protected]', 'password': '123456'}},
#     {'Stack Overflow': {'email': '[email protected]',
#                         'password': 'password'}}]

(assuming the file doesn't actually have trailing commas before closing braces)

Of course, if you only wish to read the n-th record, you can stop reading after having read n records, instead of accumulating the results in a list.

Note that this is not a standard format. Not all programming languages allow you to JSON-parse a prefix of a string (e.g. in JavaScript you would either have to write a custom parser from scratch, or hack the error message to see where the error occured so you can cut the string off there — neither option is pretty). Use standard formats wherever possible. For example, JSONL (the same format but unindented, with one JSON document per line) is easily parseable in any language because you can predictably cut the raw string into lines before JSON parsing commences, while still being appendable, like your format.

🌐
Index.dev
index.dev › blog › convert-json-to-dictionary-python
How to Convert JSON to a Python Dictionary: Step-by-Step Guide
As we can see, the JSON text is successfully translated into a Python dictionary with the identical structure. In addition to importing JSON strings, you may need to import JSON data from files. Python's json.load() function is suitable for this purpose.
🌐
W3Schools
w3schools.com › python › python_json.asp
Python JSON
Python has a built-in package called json, which can be used to work with JSON data. ... If you have a JSON string, you can parse it by using the json.loads() method. The result will be a Python dictionary.
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.
🌐
MLJAR
mljar.com › docs › python-read-json-from-file
Read JSON file to dict in Python
Load JSON file to dict. Print dict object with indentation. It is a good practice to check if file exists before reading it. There is Check if file exists recipe available. Code recipes from Python cookbook.
🌐
Real Python
realpython.com › python-json
Working With JSON Data in Python – Real Python
August 20, 2025 - When you deserialize a JSON file as a Python object, then you can interact with it natively—for example, by accessing the value of the "name" key with square bracket notation ([]). Still, there’s a word of caution here. Import the original dog_data dictionary from before and compare it to frie_data:
🌐
Spark By {Examples}
sparkbyexamples.com › home › python › convert json to dictionary in python
Convert JSON to Dictionary in Python - Spark By {Examples}
May 31, 2024 - Let’s discuss how to convert the JSON string object to a Dictionary in python. From JSON string, we can convert it to a dictionary using the json.loads() method. Suppose you have a JSON file, then loads() will not work.
🌐
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
You will need to parse it from an external json file. So let's look at the following example. 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.
🌐
Bright Data
brightdata.com › blog › how-tos › parse-json-data-with-python
Guide to Parsing JSON Data With Python
September 16, 2025 - In this case, smartphone.json becomes a Python dictionary. Perfect, parsing a JSON file in Python takes only a few lines of code!
🌐
Scaler
scaler.com › home › topics › read, write, parse json file using python
Read, Write, Parse JSON File Using Python - Scaler Topics
April 17, 2024 - JSON files are basically like Python dictionaries but on steroids. They help in storing data and enable communication with servers during deployment. More than a single programming language is often required to solve a problem, and JSON objects are a bridge between them. This article will explore how to parse JSON files with Python’s built-in JSON module. We’ll implement the code to open and read ...
🌐
Python
docs.python.org › 3 › library › json.html
json — JSON encoder and decoder
3 weeks ago - Serialize obj to a JSON formatted str using this conversion table. The arguments have the same meaning as in dump(). ... Keys in key/value pairs of JSON are always of the type str.
🌐
freeCodeCamp
freecodecamp.org › news › how-to-parse-json-in-python-with-examples
How to Parse JSON in Python – A Complete Guide With Examples
October 29, 2025 - The final example shows that valid JSON parses successfully and returns a dictionary instead of None. JSON parsing failed: Expecting ',' delimiter Error at line 1, column 19 Result 1: None JSON parsing failed: Expecting ',' delimiter Error at line 1, column 28 Result 2: None JSON parsing failed: Expecting property name enclosed in double quotes Error at line 1, column 29 Result 3: None Result 4: {'name': 'Sarah', 'age': 28} When reading JSON files, you should also handle file-related errors.
🌐
DEV Community
dev.to › koladev › handling-json-data-in-python-4lii
Handling JSON Data in Python - DEV Community
July 26, 2024 - If you're interested in more content ... you're reading, subscribe to my newsletter for regular updates on software programming, architecture, and tech-related insights. JSON is a lightweight data interchange format commonly used around information infrastructure to exchange data. In Python, the json module provides methods for parsing JSON strings and files and converting Python objects to JSON. In the next section, we will see how to convert a string to a dict...
🌐
YouTube
youtube.com › watch
Python: Read JSON file and store its contents in a dictionary - YouTube
How do I read a json file and store its contents in a Python dictionary?
Published   November 3, 2017