You are here

public function JsonEncoder::encode in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/serializer/Encoder/JsonEncoder.php \Symfony\Component\Serializer\Encoder\JsonEncoder::encode()

Encodes data into the given format.

Parameters

mixed $data Data to encode:

string $format Format name:

array $context options that normalizers/encoders have access to.:

Return value

scalar

Throws

UnexpectedValueException

Overrides EncoderInterface::encode

File

vendor/symfony/serializer/Encoder/JsonEncoder.php, line 70

Class

JsonEncoder
Encodes JSON data.

Namespace

Symfony\Component\Serializer\Encoder

Code

public function encode($data, $format, array $context = array()) {
  return $this->encodingImpl
    ->encode($data, self::FORMAT, $context);
}