Summary
    The option is used to easily upload JSON encoded data as thebody of a request. A Content-Type header of application/json will beadded if no Content-Type header is already present on the message.
    Types
    Any PHP type that can be operated on by PHP's json_encode() function.
    Default
    None
    Constant
    1. use GuzzleHttp\Middleware;
    2.  
    3. // Grab the client's handler instance.
    4. $clientHandler = $client->getConfig('handler');
    5. $tapMiddleware = Middleware::tap(function ($request) {
    6. echo $request->getHeaderLine('Content-Type');
    7. // application/json
    8. echo $request->getBody();
    9. });
    10.  
    11. $response = $client->request('PUT', '/put', [
    12. 'json' => ['foo' => 'bar'],
    13. ]);