title: TensorFlow Serving REST API - JSON Parse Error
body: <p>I've frozen and exported a <code>SavedModel</code>, which takes as input a batch of videos that has the following format according to <code>saved_model_cli</code>: </p>
  
  <pre class="lang-py prettyprint-override"><code>The given SavedModel SignatureDef contains the following input(s):
  inputs['ims_ph'] tensor_info:
      dtype: DT_UINT8
      shape: (1, 248, 224, 224, 3)
      name: Placeholder:0
  inputs['samples_ph'] tensor_info:
      dtype: DT_FLOAT
      shape: (1, 173774, 2)
      name: Placeholder_1:0
  The given SavedModel SignatureDef contains the following output(s):
  ... &lt;&lt; OUTPUTS &gt;&gt; ......
  Method name is: tensorflow/serving/predict
  </code></pre>
  
  <p>I have a TF-Serving (HTTP/REST) server successfully running locally. From my Python client code, I have 2 populated objects of type <code>numpy.ndarray</code>, named <code>ims</code> of shape (1, 248, 224, 224, 3) -- and <code>samples</code> of shape (1, 173774, 2).</p>
  
  <p>I am trying to run an inference against my TF model server (see client code below) but am receiving the following error: <code>{u'error': u'JSON Parse error: Invalid value. at offset: 0'}</code></p>
  
  <pre class="lang-py prettyprint-override"><code># I have tried the following combinations without success:
  data = {"instances" : [{"ims_ph": ims.tolist()}, {"samples_ph": samples.tolist()} ]}
  data = {"inputs" : { "ims_ph": ims, "samples_ph": samples} }
  
  r = requests.post(url="http://localhost:9000/v1/models/multisensory:predict", data=data)
  </code></pre>
  
  <p>The <a href="https://www.tensorflow.org/tfx/serving/api_rest" rel="nofollow noreferrer">TF-Serving REST docs</a> don't seem to indicate that any extra escaping / encoding is required here for these two input tensors. As these aren't binary data, I don't think base64 encoding is the right approach either. Any pointers to a working approach here would be greatly appreciated!</p>