class JsonEncoder

Same name in this branch
  1. 9 core/modules/serialization/src/Encoder/JsonEncoder.php \Drupal\serialization\Encoder\JsonEncoder
  2. 9 core/modules/hal/src/Encoder/JsonEncoder.php \Drupal\hal\Encoder\JsonEncoder
Same name in other branches
  1. 8.9.x core/modules/jsonapi/src/Encoder/JsonEncoder.php \Drupal\jsonapi\Encoder\JsonEncoder
  2. 8.9.x core/modules/serialization/src/Encoder/JsonEncoder.php \Drupal\serialization\Encoder\JsonEncoder
  3. 8.9.x core/modules/hal/src/Encoder/JsonEncoder.php \Drupal\hal\Encoder\JsonEncoder
  4. 10 core/modules/jsonapi/src/Encoder/JsonEncoder.php \Drupal\jsonapi\Encoder\JsonEncoder
  5. 10 core/modules/serialization/src/Encoder/JsonEncoder.php \Drupal\serialization\Encoder\JsonEncoder
  6. 11.x core/modules/jsonapi/src/Encoder/JsonEncoder.php \Drupal\jsonapi\Encoder\JsonEncoder
  7. 11.x core/modules/serialization/src/Encoder/JsonEncoder.php \Drupal\serialization\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
    • class \Drupal\jsonapi\Encoder\JsonEncoder extends \Drupal\serialization\Encoder\JsonEncoder

Expanded class hierarchy of JsonEncoder

See also

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

jsonapi.api.php

1 string reference to 'JsonEncoder'
jsonapi.services.yml in core/modules/jsonapi/jsonapi.services.yml
core/modules/jsonapi/jsonapi.services.yml
1 service uses JsonEncoder
serializer.encoder.jsonapi in core/modules/jsonapi/jsonapi.services.yml
Drupal\jsonapi\Encoder\JsonEncoder

File

core/modules/jsonapi/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

Title Sort descending Modifiers Object type Summary Overriden Title
JsonEncoder::$format protected static property The formats that this Encoder supports. Overrides JsonEncoder::$format
JsonEncoder::supportsDecoding public function
JsonEncoder::supportsEncoding public function
JsonEncoder::__construct public function

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.