title: Should Rest API accept POST array or JSON string?
body: <p>I've been reading a few REST tutorials and some of them says that in order to send data to a rest API you should send post data as an array, which is something like this:</p>
  
  <pre><code>$data = array('foo' =&gt; 'bar');
  $rest-&gt;post($data);
  </code></pre>
  
  <p>Then there are others that say you should send JSON data like this:</p>
  
  <pre><code>$data = array('foo' =&gt; 'bar');
  $data = json_encode($data);
  $rest-&gt;post($data);
  </code></pre>
  
  <p>Not sure if there's a standard way of doing this or either if is fine but what is generally recommended when designing API's?</p>
  
  <p>EDIT: There seems to be confusion. To clarify I agree JSON should be used for client consumption but this question is about SERVER consumption. Meaning should the SERVER accept JSON or POST data from its clients?</p>