I am new to the python world, below is my nested dictionary with values as NumPy array and I want to convert it to JSON, and convert it back to the nested 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
{'protein':
{'chicken': array([112.5 , 90. , 67.5 , 45. , 22.5 , 11.25, 0. ]),
'banana': array([200., 150., 100., 50., 25., 0.]),
'carrots': array([2.35 , 1.88 , 1.41 , 0.94 , 0.47 , 0.235, 0. ])
},
'carbohydrate':
{'chicken': array([0., 0., 0., 0., 0., 0., 0.]),
'banana': array([200., 150., 100., 50., 25., 0.]),
'carrots': array([17. , 13.6, 10.2, 6.8, 3.4, 1.7, 0. ])},
'fat':
{'chicken': array([13. , 10.4, 7.8, 5.2, 2.6, 1.3, 0. ]),
'banana': array([1.56 , 1.17 , 0.78 , 0.39 , 0.195, 0. ]),
'carrots': array([0.6 , 0.48, 0.36, 0.24, 0.12, 0.06, 0. ])
}
}