You can simply loop through your list of tuples to create dictionaries, which then can be converted to a JSON. Something like this:

import json

data = [('chocolate', '3', 5, False), ('chocolate', '5', 7, False), ('chocolate', '10', 10, False), ('honey', '3', 5, False), ('honey', '5', 7, False), ('honey', '10', 10, False), ('candy', '3', 5, False), ('candy', '5', 7, False), ('candy', '10', 10, False)]

list = [{"pack": x[0], "pack": x[1], "price": x[2], "checkstate": x[3]} for x in data]

json.dumps(list)
Answer from user10455554 on Stack Overflow
🌐
ReqBin
reqbin.com › json › python › uzykkick › json-array-example
Python | What is JSON Array?
Unlike dictionaries, where you can get the value by its key, in a JSON array, the array elements can only be accessed by their index. The following is an example of a JSON array with numbers.
Discussions

Parsing muilti dimensional Json array to Python - Stack Overflow
By array, I think "most people" mean a - possibly multidimensional - data structure composed of elements all of the same type. JSON, and their Python couterpart "arbitrarily nested dicts and lists" are usually not arrays, but "objects", that's the whole point of it: something to "hold" an arbitrary ... More on stackoverflow.com
🌐 stackoverflow.com
How to parse JSON Array of objects in python - Stack Overflow
Possible duplicate of Convert string to JSON using Python if not, then it's an array which means its already parsed as json, so I'm not sure what you're asking in that case More on stackoverflow.com
🌐 stackoverflow.com
Python Parse JSON array - Stack Overflow
I'm trying to put together a small python script that can parse out array's out of a large data set. I'm looking to pull a few key:values from each object so that I can play with them later on in the script. Here's my code: # Load up JSON Function import json # Open our JSON file and load it ... More on stackoverflow.com
🌐 stackoverflow.com
Creating JSON Array of data with python
What I’m trying to do: I’m trying to retrieve the data from database and then create a JSON Array to send it to Google Gantt. What I’ve tried and what’s not working: I’m having propably problems with the conversion of python date to JSON date. Really I’m out of ideas how to do it ... More on anvil.works
🌐 anvil.works
1
0
August 22, 2023
People also ask

What is a JSON array?
A JSON array is an ordered list of values enclosed in square brackets, with values separated by commas. Arrays are one of the two compound data structures in JSON (the other being objects). An array can contain any mix of JSON values: strings, numbers, booleans, null, objects, and other arrays. Examples: ["apple", "banana", "cherry"] is an array of strings; [1, 2, 3] is an array of numbers; [{"id": 1, "name": "Alice"}, {"id": 2, "name": "Bob"}] is an array of objects — the most common pattern in REST APIs. The order of elements in a JSON array is preserved.
🌐
jsonic.io
jsonic.io › home › guides › json array tutorial
JSON Array Tutorial — Syntax, Access, and Examples | Jsonic
How do I loop over a JSON array?
In JavaScript, after JSON.parse(), use any standard array iteration method. for...of loop: for (const item of array) { console.log(item) }. forEach: array.forEach(item => console.log(item)). map to transform: const names = users.map(u => u.name). filter to select: const active = users.filter(u => u.active). find for the first match: const alice = users.find(u => u.name === "Alice"). In Python, after json.loads(), iterate directly: for item in data: print(item). List comprehension: names = [u["name"] for u in users]. All these work the same whether the array came from JSON or was cr
🌐
jsonic.io
jsonic.io › home › guides › json array tutorial
JSON Array Tutorial — Syntax, Access, and Examples | Jsonic
Can JSON arrays mix different types?
Yes. JSON arrays have no type restriction — a single array can contain strings, numbers, booleans, null, objects, and nested arrays all together: [42, "hello", true, null, {"key": "value"}, [1, 2]]. This is syntactically valid JSON. However, in practice most APIs return arrays where all elements share the same structure, because mixed-type arrays are harder to process programmatically. If you are designing an API, use homogeneous arrays (all elements of the same type) so consumers can iterate without type-checking each element.
🌐
jsonic.io
jsonic.io › home › guides › json array tutorial
JSON Array Tutorial — Syntax, Access, and Examples | Jsonic
🌐
JSON Schema
json-schema.org › understanding-json-schema › reference › array
JSON Schema - array
In JSON, each element in an array may be of a different type. ... In Python, "array" is analogous to the list or tuple type, depending on usage.
🌐
Tech With Tech
techwithtech.com › home › json object vs. json array explained with python
JSON Object vs. JSON Array Explained With Python - Tech With Tech
November 6, 2022 - JSON arrays are structured the same as Python bracketed lists. They can have the same data types as the JSON object field values, including nested arrays. Let’s add a battery field to the JSON object above, its value is a JSON array.
Top answer
1 of 2
13

After you parse the JSON, you will end up with a Python dict. So, suppose the above JSON is in a string named input_data:

import json
# This converts from JSON to a python dict
parsed_input = json.loads(input_data)

# Now, all of your static variables are referenceable as keys:
secret = parsed_input['secret']
minutes = parsed_input['minutes']
link = parsed_input['link']

# Plus, you can get your bookmark collection as:
bookmark_collection = parsed_input['bookmark_collection']

# Print a list of names of the bookmark collections...
print bookmark_collection.keys() # Note this contains sublinks, so remove it if needed

# Get the name of the Boarding Pass bookmark:
print bookmark_collection['boarding_pass']['name']

# Print out a list of all bookmark links as:
#  Boarding Pass
#    * 1: http://www.1.com/
#    * 2: http://www.2.com/
#  ...
for bookmark_definition in bookmark_collection.values():
    # Skip sublinks...
    if bookmark_definition['name'] == 'sublinks':
        continue
    print bookmark_definition['name']
    for bookmark in bookmark_definition['bookmarks']:
        print "    * %(name)s: %(link)s" % bookmark

# Get the sublink definition:
sublinks = parsed_input['bookmark_collection']['sublinks']

# .. and print them
print sublinks['name']
for link in sublinks['link']:
    print '  *', link
2 of 2
2

Hmm, doesn't json.loads do the trick?

For example, if your data is in a file,

import json
text = open('/tmp/mydata.json').read()

d = json.loads(text)

# first level fields
print d['minutes'] # or 'secret' or 'link'

# the names of each of bookmark_collections's items
print d['bookmark_collection'].keys()

# the sublinks section, as a dict
print d['bookmark_collection']['sublinks']

The output of this code (given your sample input above) is:

20
[u'sublinks', u'free_link', u'boarding_pass']
{u'link': [u'http://www.1.com', u'http://www.2.com', u'http://www.3.com'], u'name': u'sublinks'}

Which, I think, gets you what you need?

Find elsewhere
🌐
Python Examples
pythonexamples.org › python-json-to-list
Python JSON to List
In this example, we will take a JSON String with Array of Arrays and convert it to Python List of Lists.
🌐
Jsonic
jsonic.io › home › guides › json array tutorial
JSON Array Tutorial — Syntax, Access, and Examples | Jsonic
May 11, 2026 - JSON array syntax, nested arrays, arrays of objects, and element access in JavaScript and Python.
Top answer
1 of 2
47

In your for loop statement, Each item in json_array is a dictionary and the dictionary does not have a key store_details. So I modified the program a little bit

import json

input_file = open ('stores-small.json')
json_array = json.load(input_file)
store_list = []

for item in json_array:
    store_details = {"name":None, "city":None}
    store_details['name'] = item['name']
    store_details['city'] = item['city']
    store_list.append(store_details)

print(store_list)
2 of 2
1

If you arrived at this question simply looking for a way to read a json file into memory, then use the built-in json module.

with open(file_path, 'r') as f:
    data = json.load(f)

If you have a json string in memory that needs to be parsed, use json.loads() instead:

data = json.loads(my_json_string)

Either way, now data is converted into a Python data structure (list/dictionary) that may be (deeply) nested and you'll need Python methods to manipulate it.


If you arrived here looking for ways to get values under several keys as in the OP, then the question is about looping over a Python data structure. For a not-so-deeply-nested data structure, the most readable (and possibly the fastest) way is a list / dict comprehension. For example, for the requirement in the OP, a list comprehension does the job.

store_list = [{'name': item['name'], 'city': item['city']} for item in json_array]
# [{'name': 'Mall of America', 'city': 'Bloomington'}, {'name': 'Tempe Marketplace', 'city': 'Tempe'}]

Other types of common data manipulation:

  1. For a nested list where each sub-list is a list of items in the json_array.

    store_list = [[item['name'], item['city']] for item in json_array]
    # [['Mall of America', 'Bloomington'], ['Tempe Marketplace', 'Tempe']]
    
  2. For a dictionary of lists where each key-value pair is a category-values in the json_array.

    store_data = {'name': [], 'city': []}
    for item in json_array:
        store_data['name'].append(item['name'])
        store_data['city'].append(item['city'])
    # {'name': ['Mall of America', 'Tempe Marketplace'], 'city': ['Bloomington', 'Tempe']}
    
  3. For a "transposed" nested list where each sub-list is a "category" in json_array.

    store_list = list(store_data.values())
    # [['Mall of America', 'Tempe Marketplace'], ['Bloomington', 'Tempe']]
    
🌐
Python Guides
pythonguides.com › json-data-in-python
How to Extract Values from a JSON Array in Python
April 27, 2026 - Learn to get values from a JSON array in Python. We cover the json module, list comprehensions, and handling nested data with real-world USA business examples.
🌐
GeeksforGeeks
geeksforgeeks.org › python › loop-through-a-json-array-in-python
Loop through a JSON array in Python - GeeksforGeeks
July 23, 2025 - A JSON array is an ordered list of values that can store multiple values such as string, number, boolean, or object. The values in a JSON array must be separated by commas and enclosed in squares in brackets []. In this article, we will learn ...
🌐
Vertabelo Academy
academy.vertabelo.com › course › python-json › reading-json-files › reading-json-files › json-with-arrays
How to Read and Write JSON Files in Python | Learn Python | Vertabelo Academy
But we don't need to have a separate file for every employee or customer; we can store this information in a single JSON file. How? By using an array. ... When a JSON file contains an array, then json.load() will load it as a Python list.
🌐
CodeUtility
blog.codeutility.io › programming › how-to-use-arrays-in-json-with-examples-in-code-5eeef2665f
How to use Arrays in JSON (With Examples in Code) | CodeUtility
September 26, 2025 - This structure is both flexible and powerful, allowing you to perform operations like filtering, sorting, updating, and serializing easily with native Python features such as list comprehensions, sorted(), and dictionary unpacking. import json # Sample JSON array of objects (Python list of dicts) users = [ { "name": "Alice", "active": True }, { "name": "Bob", "active": False }, { "name": "Carol", "active": True } ] # 1.
🌐
Delft Stack
delftstack.com › home › howto › python › parse json array of objects in python
How to Parse JSON Array of Objects in Python | Delft Stack
February 2, 2024 - The JSON data string is parsed by the json.loads() function, which then provides a Python dictionary with all of the data from the JSON. You may get parsed data from this Python dictionary by using names or indexes to refer to objects. We can also examine the dictionary for nested JSON items. Use the associated method json.load() to parse a JSON file (without the s). we have used json.loads for parsing the values in the array in the below example.
🌐
W3Schools
w3schools.com › js › js_json_server.asp
W3Schools.com
If the file contains a JSON array, response.json() returns a JavaScript array.
🌐
Reddit
reddit.com › r/python › storing and querying large json array of data
r/Python on Reddit: Storing and querying large json array of data
October 13, 2022 -

I've written a list below of what I am trying to achieve. I'm just unsure of the best way to store the data, my main considerations are the speed in which I can query the data and RAM usage when running the query.

My Python script queries an API which returns a JSON array containing 1000 entries of data. The script will iterate through each page of the API until there is no more data to be retrieved. This should result in 140 million entries in the end up.

I need to store the JSON somewhere, I've be told I can lump all of it into a JSON file. I've no idea how large that would make the file or what it would mean when it comes to trying to query it, which ill need to do. I could store it in a database, something like MySQL, again not sure what this means in terms of the size of the database, time taken to query and if machine RAM would be a factor, both for MySQL and a JSON file?

Once the JSON is stored, I need to query all 140 million entries to produce a kind of summary report (was planning on writing a python script for this) (regardless of what the data is stored in, a python script will still query the 140 million entries).

After the Python script produces the report, I will store it in a MySQL database where a PHP script will pickup the data and display it on a webpage.

Thanks

🌐
Tech With Tech
techwithtech.com › home › converting list to json array in python: how to?
Converting List to JSON Array in Python: How To? - Tech With Tech
October 27, 2022 - Next we’ll convert JSON arrays to Python lists. This is called deserialization. In addition, you’ll figure out how to combine two separate lists with field names and values into a single JSON object. ... According to json.org, JSON is a lightweight data exchange format. It’s easy for humans to read and write. Machines can easily interpret and generate JSON. Don’t be intimidated by JavaScript in the acronym. JSON was born out of this language but turned out to be a great tool for sending data, for example in HTTP requests.