title: In Laravel, send a post request with json object data
body: <p>I want to send request with Http facade in Laravel but i can't pass json object data it must be just array.</p>
  <pre><code>Http::withHeaders(['Content-Type' =&gt; 'application/json'])-&gt;withOptions(['headers' =&gt; $coockie])-&gt;post($this-&gt;policy_url . $address, json_encode($data));
  </code></pre>
  <p>My data variable value:</p>
  <pre><code>$data = [
      &quot;document&quot; =&gt; [
          &quot;customerId&quot; =&gt; 1,
          &quot;currencyId&quot; =&gt; 1,
          &quot;settlementPolicyId&quot; =&gt; 8,
          &quot;storeId&quot; =&gt; 16,
          &quot;documentPatternId&quot; =&gt; 2,
          &quot;items&quot; =&gt; [
              [
                &quot;productId&quot; =&gt; 193,
                &quot;unitId&quot; =&gt; 2,
                &quot;quantity&quot; =&gt; 1,
                &quot;storeId&quot; =&gt; 16,
                &quot;TrackingFactor1&quot; =&gt; &quot;1214&quot;,
                &quot;PartTrackingFactorRef1&quot; =&gt; 1053,
                &quot;TrackingFactorHasQuantity1&quot; =&gt; true,
                &quot;TrackingFactorValue&quot; =&gt; &quot;‏test&quot;,
                &quot;fee&quot; =&gt; 0
              ]
            ]
          ],
          &quot;payments&quot; =&gt; [
              [
                  &quot;key&quot; =&gt; &quot;Cash&quot;,
                  &quot;amount&quot; =&gt; 445810,
                  &quot;attr&quot; =&gt; []
              ]
          ]
      ];
  </code></pre>
  <p>The error:</p>
  <pre><code>TypeError Argument 2 passed to Illuminate\Http\Client\PendingRequest::post() must be of the type array, string given
  </code></pre>