NOTE: For Version 3 of the AWS SDK for PHP, please see the V3 User Guide and V3 API Reference.

# Class JsonVisitor

Visitor used to apply a parameter to an array that will be serialized as a top level key-value pair in a JSON body

  Guzzle\Service\Command\LocationVisitor\Request\AbstractRequestVisitor implements Guzzle\Service\Command\LocationVisitor\Request\RequestVisitorInterface
  Guzzle\Service\Command\LocationVisitor\Request\JsonVisitor

Namespace: Guzzle\Service\Command\LocationVisitor\Request
Located at Guzzle/Service/Command/LocationVisitor/Request/JsonVisitor.php

## Methods summary

- `public` `__construct ( )`
- `public` `setContentTypeHeader ( string $header = 'application/json' )`

  Set the Content-Type header to add to the request if JSON is added to the body. This visitor does not add a Content-Type header unless you specify one here.

- `public` `visit ( Guzzle\Service\Command\CommandInterface $command, Guzzle\Http\Message\RequestInterface $request, Guzzle\Service\Description\Parameter $param, mixed $value )`
- `public` `after ( Guzzle\Service\Command\CommandInterface $command, Guzzle\Http\Message\RequestInterface $request )`

## Methods detail

# `public`
`__construct( )`
# `public `Guzzle\Service\Command\LocationVisitor\Request\JsonVisitor``
`setContentTypeHeader( string $header = 'application/json' )`

Set the Content-Type header to add to the request if JSON is added to the body. This visitor does not add a Content-Type header unless you specify one here.

#### Parameters

$header
  `string`
  $header Header to set when JSON is added (e.g. application/json)

#### Returns

``Guzzle\Service\Command\LocationVisitor\Request\JsonVisitor``
# `public`
`visit( `Guzzle\Service\Command\CommandInterface` $command, `Guzzle\Http\Message\RequestInterface` $request, `Guzzle\Service\Description\Parameter` $param, mixed $value )`

#### Parameters

$command
  ``Guzzle\Service\Command\CommandInterface``
  $command Command being visited
$request
  ``Guzzle\Http\Message\RequestInterface``
  $request Request being visited
$param
  ``Guzzle\Service\Description\Parameter``
  $param Parameter being visited
$value
  `mixed`
  $value Value to set

#### CodeCoverageIgnore

#### Overrides

`Guzzle\Service\Command\LocationVisitor\Request\AbstractRequestVisitor::visit`
# `public`
`after( `Guzzle\Service\Command\CommandInterface` $command, `Guzzle\Http\Message\RequestInterface` $request )`

#### Parameters

$command
  ``Guzzle\Service\Command\CommandInterface``
  $command Command being visited
$request
  ``Guzzle\Http\Message\RequestInterface``
  $request Request being visited

#### CodeCoverageIgnore

#### Overrides

`Guzzle\Service\Command\LocationVisitor\Request\AbstractRequestVisitor::after`

### Methods inherited from Guzzle\Service\Command\LocationVisitor\Request\AbstractRequestVisitor

`prepareValue()`, `resolveRecursively()`

### Magic methods summary

## Properties summary

`protected boolean` | $jsonContentType | # Whether or not to add a Content-Type header when JSON is found
`protected `SplObjectStorage`` | $data | # Data object for persisting JSON data