You are here

class JsonEncoder in JSON:API 8.2

Same name and namespace in other branches
  1. 8 src/Encoder/JsonEncoder.php \Drupal\jsonapi\Encoder\JsonEncoder

Encodes JSON:API data.

@internal JSON:API maintains no PHP API. The API is the HTTP API. This class may change at any time and could break any dependencies on it.

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

See also

https://www.drupal.org/project/jsonapi/issues/3032787

jsonapi.api.php

1 file declares its use of JsonEncoder
ResourceResponseValidatorTest.php in tests/src/Unit/EventSubscriber/ResourceResponseValidatorTest.php
1 string reference to 'JsonEncoder'
jsonapi.services.yml in ./jsonapi.services.yml
jsonapi.services.yml
1 service uses JsonEncoder
serializer.encoder.jsonapi in ./jsonapi.services.yml
Drupal\jsonapi\Encoder\JsonEncoder

File

src/Encoder/JsonEncoder.php, line 16

Namespace

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

  /**
   * The formats that this Encoder supports.
   *
   * @var string
   */
  protected static $format = [
    'api_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