Converting your numpy array to a list works (if there is a version of json
that handles arrays directly it probably is doing this conversion). Here I'm working with a sample 2d array.
In [8]: x=np.linspace(0,1,10).reshape(2,5).round(3)
In [9]: x
Out[9]:
array([[ 0. , 0.111, 0.222, 0.333, 0.444],
[ 0.556, 0.667, 0.778, 0.889, 1. ]])
In [10]: json.dumps(x.tolist())
Out[10]: '[[0.0, 0.111, 0.222, 0.333, 0.444], [0.556, 0.667, 0.778, 0.889, 1.0]]'
What kind of output do you want transfer from sympy
? If the formulas are turned into strings, json.dumps
should have no problems.