- Oct 19, 2021 · Use json.dumps() to convert a list to a JSON array in Python. The dumps() function takes a list as an argument and returns a JSON String.
- Numpy deals with the arrays. Numpy is useful in Machine learning also. It is good to be included as we come across multi-dimensional arrays in python. As we know, arrays are to store homogeneous data items in a single variable. Arrays in Python is nothing but the list. Look at the following code snippet. Here, we have a list of named colors.
- For example, a Python tuple will be serialized as a JSON array. When we deserialize the array, we will get a Python list containing the data in the tuple. If we want our original tuple object back, we need to pass this list into the initializer for the tuple.