<h3 dir="auto">Reproducing code example:</h3>

<p dir="auto">There should be a default serializer for the type of <strong>float32</strong> defined. Flask/jsonify() can serilize the type of float64 but not float32.</p>
<p dir="auto">The following code throws error: TypeError: Object of type float32 is not JSON serializable</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="    x = {'value': numpy.float32(0.1)}
    return jsonify(x)"><pre class="notranslate">    <span class="pl-s1">x</span> <span class="pl-c1">=</span> {<span class="pl-s">'value'</span>: <span class="pl-s1">numpy</span>.<span class="pl-en">float32</span>(<span class="pl-c1">0.1</span>)}
    <span class="pl-k">return</span> <span class="pl-en">jsonify</span>(<span class="pl-s1">x</span>)</pre></div>
<p dir="auto">This one works:</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="    x = {'value': numpy.float64(0.1)}
    return jsonify(x)"><pre class="notranslate">    <span class="pl-s1">x</span> <span class="pl-c1">=</span> {<span class="pl-s">'value'</span>: <span class="pl-s1">numpy</span>.<span class="pl-en">float64</span>(<span class="pl-c1">0.1</span>)}
    <span class="pl-k">return</span> <span class="pl-en">jsonify</span>(<span class="pl-s1">x</span>)</pre></div>
<h3 dir="auto">Error message:</h3>
<p dir="auto">TypeError: Object of type float32 is not JSON serializable</p>


<h3 dir="auto">NumPy/Python version information:</h3>
<p dir="auto">It seems that the np.geomspace() functions produces wrong numbers</p>
<h3 dir="auto">Reproducing code example:</h3>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="import numpy as np

a = np.geomspace(1, 16, 5, dtype=int)
print(a)

[ 1  2  4  7 16]"><pre class="notranslate"><span class="pl-k">import</span> <span class="pl-s1">numpy</span> <span class="pl-k">as</span> <span class="pl-s1">np</span>

<span class="pl-s1">a</span> <span class="pl-c1">=</span> <span class="pl-s1">np</span>.<span class="pl-en">geomspace</span>(<span class="pl-c1">1</span>, <span class="pl-c1">16</span>, <span class="pl-c1">5</span>, <span class="pl-s1">dtype</span><span class="pl-c1">=</span><span class="pl-s1">int</span>)
<span class="pl-en">print</span>(<span class="pl-s1">a</span>)

[ <span class="pl-c1">1</span>  <span class="pl-c1">2</span>  <span class="pl-c1">4</span>  <span class="pl-c1">7</span> <span class="pl-c1">16</span>]</pre></div>
<p dir="auto">The correct answer should be</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="[ 1  2  4  8 16]"><pre class="notranslate">[ <span class="pl-c1">1</span>  <span class="pl-c1">2</span>  <span class="pl-c1">4</span>  <span class="pl-c1">8</span> <span class="pl-c1">16</span>]</pre></div>
<h3 dir="auto">NumPy/Python version information:</h3>
<p dir="auto">1.19.1 3.8.5 (tags/v3.8.5:580fbb0, Jul 20 2020, 15:57:54) [MSC v.1924 64 bit (AMD64)]</p>