import json

array = '{"fruits": ["apple", "banana", "orange"]}'
data  = json.loads(array)
print(data['fruits']) 
# the print displays:
# ['apple', 'banana', 'orange']

You had everything you needed. data will be a dict, and data['fruits'] will be a list

Answer from jdi on Stack Overflow
🌐
GeeksforGeeks
geeksforgeeks.org › python › python-json-to-list
Python Json To List - GeeksforGeeks
July 23, 2025 - In this example, the below code utilizes the `json.loads()` method to convert a JSON-formatted string `[1,2,3,4]` into a Python list named `array`. The `print` statements display the type of the original string, the first element of the resulting list, and the type of the converted list, respectively.
Discussions

List all JSON keys in a file to identify database column names from a file using Python
JSON is just a string. You can convert that string into a Python data structure. If that string exists in a file, here is how to read that content. import json with open('the_file.json') as file: data = json.load(file) keys = data.keys() More on reddit.com
🌐 r/learnpython
10
2
July 9, 2022
How can I convert a JSON array to a Python list? - TestMu AI Community
I have the following JSON array: import json array = '{"fruits": ["apple", "banana", "orange"]}' data = json.loads(array) In this case, I want to convert all the values in the ‘fruits’ string to a Python list. What is the correct way of doing this using Python JSON to list? More on community.testmuai.com
🌐 community.testmuai.com
0
January 9, 2025
How to parse JSON file into Python list - Stack Overflow
I am trying to parse a JSON file into Python but failing to print any specific data I am trying to pull from JSON. How can I put these JSON data in separate arrays, so I can play with them in Pyth... More on stackoverflow.com
🌐 stackoverflow.com
convert JSON list to dictionary
If I'm not wrong, your JSON file is a list of dictionaries. Which means, you can iterate over the loop to access each dictionary, upon which you can use the relevant method to get the student id. You can connect with me on loljaegar@gmail.com if you wanna screen share and discuss. More on reddit.com
🌐 r/learnpython
8
0
January 13, 2024
🌐
Python Examples
pythonexamples.org › python-json-to-list
Python JSON to List
Python JSON to List - To convert a JSON String to Python List, use json.loads() function. loads() function takes JSON Array string as argument and returns a Python List. In this tutorial, we have examples to load json array string to python list.
🌐
GeeksforGeeks
geeksforgeeks.org › python › convert-python-list-to-json
Convert Python List to Json - GeeksforGeeks
July 23, 2025 - JSON (JavaScript Object Notation) is a lightweight data interchange format that is easy for humans to read and write, and easy for machines to parse and generate. In Python, the json module provides a convenient way to work with JSON data. In this article, we'll explore how to convert Python lists to JSON, along with some examples.
🌐
CodeSpeedy
codespeedy.com › home › convert json to list in python
Convert JSON to list in Python - CodeSpeedy
July 9, 2019 - Initially, we declared a JSON array, ‘array’ which is a string. json.loads(array) converts JSON array to Python object i.e. list (here) and the value is stored in data variable. Then by using the print statement, we printed out the Python list.
🌐
Reddit
reddit.com › r/learnpython › list all json keys in a file to identify database column names from a file using python
r/learnpython on Reddit: List all JSON keys in a file to identify database column names from a file using Python
July 9, 2022 -

I am learning Python, and in particular, working with JSON and sqlite in Python. Ultimately I plan to use Python to load the JSON into a sqlite database.

Here is the question: Is there a way in to list all of the keys from a JSON file (not from a string) using Python? I want a list of all of the keys so I can determine what columns I will need/use in my sqlite table(s), without having to manually read the file and make a list.

BTW, this is something along the lines of using INFORMATION_SCHEMA.COLUMNS in SQL Server, or the FINDALL in Python for XML.

All of this is for personal learning, so I'm not looking to use other technologies, I'm sticking to Python, JSON, and sqlite on purpose.

🌐
W3Schools
w3schools.com › python › python_json.asp
Python JSON
Remove List Duplicates Reverse a String Add Two Numbers · Python Examples Python Compiler Python Exercises Python Quiz Python Challenges Python Server Python Syllabus Python Study Plan Python Interview Q&A Python Bootcamp Python Certificate Python Training ... JSON is a syntax for storing and exchanging data. JSON is text, written with JavaScript object notation. Python has a built-in package called json, which can be used to ...
Find elsewhere
🌐
TestMu AI Community
community.testmuai.com › ask a question
How can I convert a JSON array to a Python list? - TestMu AI Community
January 9, 2025 - I have the following JSON array: import json array = '{"fruits": ["apple", "banana", "orange"]}' data = json.loads(array) In this case, I want to convert all the values in the ‘fruits’ string to a Python list. What is…
🌐
Softhints
softhints.com › python-json-to-list-and-json-to-dict-examples
Python json to list and json to dict examples - Softhints
February 10, 2022 - In order to retrieve list from JSON structure you need to use access operator. So if your JSON containing objects which are Arrays / List you can access them by: ... import json jsonData = '{"list": ["java", "python", "groovy", "ruby"]}' jsonData ...
🌐
Python
docs.python.org › 3 › library › json.html
JSON encoder and decoder — Python 3.14.3 documentation
February 23, 2026 - The old version of JSON specified by the obsolete RFC 4627 required that the top-level value of a JSON text must be either a JSON object or array (Python dict or list), and could not be a JSON null, boolean, number, or string value.
🌐
DataCamp
datacamp.com › tutorial › json-data-python
Python JSON Data: A Guide With Examples | DataCamp
December 3, 2024 - While Python is capable of storing intricate data structures such as sets and dictionaries, JSON is limited to handling strings, numbers, booleans, arrays, and objects. Let’s look at some of the differences: To convert a Python list to JSON format, you can use the json.dumps() method from ...
🌐
Quora
quora.com › How-do-you-parse-a-JSON-list-in-Python
How to parse a JSON list in Python - Quora
Answer (1 of 3): Before you can start working with JSON in Python, you'll need some JSON to work with. There are a few things that you'll need to set up first. First, create a Python file that will hold your code for these exercises. Inside the file, import the JSON module. [code]import json [/c...
🌐
AskPython
askpython.com › home › convert a list to json string in python [easy step-by-step]
Convert a List to JSON String in Python [Easy Step-By-Step] - AskPython
May 30, 2023 - Hence, we do not have to install it manually on our local system. We can directly import in by using the import statement. ... The json module has a function dumps() that is used to convert a list to JSON in Python.
Top answer
1 of 4
3

There's just a slight problem with your for loop.

james@VIII:~/Desktop$ ls
f.txt
james@VIII:~/Desktop$ cat f.txt 
{
"Ask":
   {"0":[[9.13,30200],[9.14,106946],[9.15,53072],[9.16,58104],[9.17,45589]],
    "1":[[9.14,106946],[9.15,53072],[9.16,58104],[9.17,45589],[9.18,37521]] },

"Bid":
   {"0":[[9.12,198807],[9.11,1110],[9.1,42110],[9.09,84381],[9.08,98178]],
    "1":[[9.13,13500],[9.12,198807],[9.11,1110],[9.1,42110],[9.09,84381]]}
}
james@VIII:~/Desktop$ python3
Python 3.6.7 (default, Oct 22 2018, 11:32:17) 
[GCC 8.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import json
>>> with open('f.txt') as f_in:
...     data = json.load(f_in)
... 
>>> data
{'Ask': {'0': [[9.13, 30200], [9.14, 106946], [9.15, 53072], [9.16, 58104], [9.17, 45589]], '1': [[9.14, 106946], [9.15, 53072], [9.16, 58104], [9.17, 45589], [9.18, 37521]]}, 'Bid': {'0': [[9.12, 198807], [9.11, 1110], [9.1, 42110], [9.09, 84381], [9.08, 98178]], '1': [[9.13, 13500], [9.12, 198807], [9.11, 1110], [9.1, 42110], [9.09, 84381]]}}
>>> data['Ask']
{'0': [[9.13, 30200], [9.14, 106946], [9.15, 53072], [9.16, 58104], [9.17, 45589]], '1': [[9.14, 106946], [9.15, 53072], [9.16, 58104], [9.17, 45589], [9.18, 37521]]}
>>> 
>>> data['Bid']
{'0': [[9.12, 198807], [9.11, 1110], [9.1, 42110], [9.09, 84381], [9.08, 98178]], '1': [[9.13, 13500], [9.12, 198807], [9.11, 1110], [9.1, 42110], [9.09, 84381]]}
>>> for x in data['Bid']['0']:
...     print(x)
... 
[9.12, 198807]
[9.11, 1110]
[9.1, 42110]
[9.09, 84381]
[9.08, 98178]

Your for loop just needed to be changed a little.

PS you don't need to specify 'r' when reading the file.

You can also get individual values like this:

>>> for x in data['Bid']['0']:
...     print(str(x[0]) + ': ' + str(x[1]))
... 
9.12: 198807
9.11: 1110
9.1: 42110
9.09: 84381
9.08: 98178
2 of 4
0

your for is loop in the keys of dict.

for x in data["Bid"]:
  print(type(x))
# <class 'str'>

try it:

for x in data['Bid']['0']:
 print(x)

or

for x in data['Bid'].values():
 print(x)

sorry for my English :)

🌐
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 - After parsing, products is a Python list containing three dictionaries. You can now use standard Python list operations on the parsed data. The len() function returns the number of items, and you can iterate through the list with a for loop.
🌐
Real Python
realpython.com › python-json
Working With JSON Data in Python – Real Python
August 20, 2025 - As you learned before, there are Python data types like tuple that you can convert into JSON, but you’ll end up with an array data type in the JSON file. Once you convert the JSON data back to Python, then an array deserializes into the Python list data type.
🌐
W3Schools
w3schools.com › python › gloss_python_convert_into_JSON.asp
Python Convert From Python to JSON
Remove List Duplicates Reverse ... ... If you have a Python object, you can convert it into a JSON string by using the json.dumps() method....
🌐
Python Examples
pythonexamples.org › python-list-to-json
Python List to JSON
import json a_list = [41, 58, 63] json_string = json.dumps(a_list) print(json_string) ... In this example, we will take a Python List with Dictionaries as elements and convert it to JSON string.
🌐
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!