I am learning python development and I am new to the python world, below is my dictionary with values as NumPy array and I want to convert it to JSON, and convert it back to the dictionary with NumPy array from JSON. Actually, I am trying to convert it using json.dumps() but it is giving me an error that says: the object of type ndarray is not JSON serializable
{
'chicken': array([5. , 4. , 3. , 2. , 1. , 0.5, 0. ]),
'banana': array([4. , 3. , 2. , 1. , 0.5, 0. ]),
'carrots': array([5. , 4. , 3. , 2. , 1. , 0.5, 0. ]),
'turkey': array([5. , 4. , 3. , 2. , 1. , 0.5, 0. ]),
'rice': array([3. , 2. , 1. , 0.5, 0. ]),
'whey': array([5. , 4. , 3. , 2. , 1. , 0.5, 0. ]),
'peanut': array([5. , 4. , 3. , 2. , 1. , 0.5, 0. ]),
'Yellow Cake (with Vanilla Frosting)': array([5. , 4. , 3. , 2. , 1. , 0.5, 0. ])
}
I am doing this because I want to pass data from one AWS Lambda function to another AWS Lambda function. Any help will be appreciated, Thanks.