public function JsonEncode::encode

Encodes PHP data to a JSON string

Parameters

mixed $data:

Return value

string

Overrides EncoderInterface::encode

File

drupal/core/vendor/symfony/serializer/Symfony/Component/Serializer/Encoder/JsonEncode.php, line 48

Class

JsonEncode
Encodes JSON data

Namespace

Symfony\Component\Serializer\Encoder

Code

public function encode($data, $format) {
  $encodedJson = json_encode($data, $this->options);
  $this->lastError = json_last_error();
  return $encodedJson;
}