Just adding onto alexce's response, you can easily convert the restructured data into JSON:

import json
json.dumps(result)

There are some potential security concerns with top-level arrays. I'm not sure if they're still valid with modern browsers, but you may want to consider wrapping it in an object.

import json
json.dumps({'results': result})
Answer from ngraves on Stack Overflow
๐ŸŒ
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 ...
๐ŸŒ
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....
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ python โ€บ convert-python-list-to-json
Convert Python List to Json - GeeksforGeeks
July 23, 2025 - In this example, a Python list containing a mix of integers and strings (list_1) is converted to a JSON-formatted string (json_str) using json.dumps().
๐ŸŒ
Python Examples
pythonexamples.org โ€บ python-list-to-json
Python List to JSON
In this Python JSON Tutorial, we learned how to convert a Python List into JSON string.
๐ŸŒ
Spark By {Examples}
sparkbyexamples.com โ€บ home โ€บ python โ€บ convert python list to json examples
Convert Python List to JSON Examples - Spark By {Examples}
March 27, 2024 - How to convert a list to JSON in Python? You can use the json.dumps() method to convert a Python list to a JSON string. This function takes a list as an argument and returns the JSON value.
๐ŸŒ
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 - In this tutorial, we will see a method to convert a list to a JSON string using json module. Weโ€™ll also learn how to convert a list of lists and a list of dictionaries to a JSON string. With that being said, letโ€™s dive deeper into the interesting content. ... The json module in Python is used to work with JSON objects and files.
๐ŸŒ
Medium
medium.com โ€บ @wepypixel โ€บ how-to-convert-a-list-to-json-python-simple-technique-pypixel-c329f6de5d7a
How to Convert a List to JSON Python? Simple Technique -PyPixel | by Stilest | Medium
August 26, 2023 - First, we will be importing Pythonโ€™s in-built json module into your Python script by adding this line of code: ... Now just for an example, we will create a dummy list that we will further use to convert the list to JSON in Python:
Find elsewhere
๐ŸŒ
Quora
quora.com โ€บ How-do-I-convert-a-list-to-JSON-in-Python
How to convert a list to JSON in Python - Quora
json.dump(py_list, f, ensure_ascii=False, indent=2) Options: indent formats output, ensure_ascii=False preserves non-ASCII characters. ... Converting a Python list to JSON is straightforward using the built-in json module.
๐ŸŒ
DataCamp
datacamp.com โ€บ community โ€บ tutorials โ€บ 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 ...
๐ŸŒ
Real Python
realpython.com โ€บ python-json
Working With JSON Data in Python โ€“ Real Python
August 20, 2025 - The json module allows you to convert common Python data types to JSON. Hereโ€™s an overview of all Python data types and values that you can convert to JSON values: Note that different Python data types like lists and tuples serialize to the same JSON array data type.
๐ŸŒ
DEV Community
dev.to โ€บ wepypixel โ€บ how-to-convert-a-list-to-json-python-best-simple-technique-2oee
How to Convert a List to JSON Python? Best Simple Technique - DEV Community
September 10, 2023 - First we will be importing the Pythonโ€™s in-built json module into your Python script by adding this line of code: ... Now just for an example we will create a dummy list that we will further used to convert list to json in python:
๐ŸŒ
Finxter
blog.finxter.com โ€บ 5-best-ways-to-convert-a-python-list-to-json
5 Best Ways to Convert a Python List to JSON โ€“ Be on the Right Side of Change
February 20, 2024 - The json.dumps() method in Python can be used to convert a list to a JSON formatted string.
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ python โ€บ python-convert-list-of-dictionaries-to-json
Python - Convert list of dictionaries to JSON - GeeksforGeeks
July 5, 2025 - The default parameter in json.dumps() helps serialize non-serializable data types. You can pass a lambda function to convert types like tuples to lists.
๐ŸŒ
Finxter
blog.finxter.com โ€บ 5-best-ways-to-convert-a-python-list-to-a-json-file
5 Best Ways to Convert a Python List to a JSON File โ€“ Be on the Right Side of Change
February 20, 2024 - The json.dump() function is a simple and direct way to convert a Python list to a JSON file. It writes the Python list as a JSON formatted stream to the specified file.
๐ŸŒ
W3Schools
w3schools.com โ€บ python โ€บ gloss_python_format_json.asp
Python Format JSON
Python JSON Tutorial JSON Parse JSON Convert into JSON Sort JSON ... If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail: sales@w3schools.com