You are here

class JsonEncoder in Drupal 8

Same name in this branch
  1. 8 core/modules/jsonapi/src/Encoder/JsonEncoder.php \Drupal\jsonapi\Encoder\JsonEncoder
  2. 8 core/modules/hal/src/Encoder/JsonEncoder.php \Drupal\hal\Encoder\JsonEncoder
  3. 8 core/modules/serialization/src/Encoder/JsonEncoder.php \Drupal\serialization\Encoder\JsonEncoder
Same name and namespace in other branches
  1. 9 core/modules/hal/src/Encoder/JsonEncoder.php \Drupal\hal\Encoder\JsonEncoder

Encodes HAL data in JSON.

Simply respond to hal_json format requests using the JSON encoder.

Hierarchy

  • class \Drupal\serialization\Encoder\JsonEncoder extends \Symfony\Component\Serializer\Encoder\JsonEncoder implements \Symfony\Component\Serializer\Encoder\EncoderInterface, \Symfony\Component\Serializer\Encoder\DecoderInterface

Expanded class hierarchy of JsonEncoder

1 file declares its use of JsonEncoder
UserLoginHttpTest.php in core/modules/user/tests/src/Functional/UserLoginHttpTest.php
1 string reference to 'JsonEncoder'
hal.services.yml in core/modules/hal/hal.services.yml
core/modules/hal/hal.services.yml
1 service uses JsonEncoder
serializer.encoder.hal in core/modules/hal/hal.services.yml
Drupal\hal\Encoder\JsonEncoder

File

core/modules/hal/src/Encoder/JsonEncoder.php, line 12

Namespace

Drupal\hal\Encoder
View source
class JsonEncoder extends SerializationJsonEncoder {

  /**
   * The formats that this Encoder supports.
   *
   * @var string
   */
  protected static $format = [
    'hal_json',
  ];

}

Members

Namesort descending Modifiers Type Description Overrides
JsonEncoder::$format protected static property The formats that this Encoder supports. Overrides JsonEncoder::$format
JsonEncoder::getJsonDecode private function Instantiates a JsonDecode instance.
JsonEncoder::getJsonEncode private function Instantiates a JsonEncode instance.
JsonEncoder::supportsDecoding public function Checks whether the deserializer can decode from given format.
JsonEncoder::supportsEncoding public function Checks whether the serializer can encode to given format.
JsonEncoder::__construct public function