You are here

class JsonEncoder in Zircon Profile 8

Same name in this branch
  1. 8 vendor/symfony/serializer/Encoder/JsonEncoder.php \Symfony\Component\Serializer\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. 8.0 core/modules/serialization/src/Encoder/JsonEncoder.php \Drupal\serialization\Encoder\JsonEncoder

Adds 'ajax to the supported content types of the JSON encoder'

Hierarchy

Expanded class hierarchy of JsonEncoder

1 file declares its use of JsonEncoder
JsonEncoderTest.php in core/modules/serialization/tests/src/Unit/Encoder/JsonEncoderTest.php
Contains \Drupal\Tests\serialization\Unit\Encoder\JsonEncoderTest.
1 string reference to 'JsonEncoder'
serialization.services.yml in core/modules/serialization/serialization.services.yml
core/modules/serialization/serialization.services.yml
1 service uses JsonEncoder
serializer.encoder.json in core/modules/serialization/serialization.services.yml
Drupal\serialization\Encoder\JsonEncoder

File

core/modules/serialization/src/Encoder/JsonEncoder.php, line 17
Contains \Drupal\serialization\Encoder\JsonEncoder.

Namespace

Drupal\serialization\Encoder
View source
class JsonEncoder extends BaseJsonEncoder implements EncoderInterface, DecoderInterface {

  /**
   * The formats that this Encoder supports.
   *
   * @var array
   */
  protected static $format = array(
    'json',
    'ajax',
  );

  /**
   * {@inheritdoc}
   */
  public function supportsEncoding($format) {
    return in_array($format, static::$format);
  }

  /**
   * {@inheritdoc}
   */
  public function supportsDecoding($format) {
    return in_array($format, static::$format);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
JsonEncoder::$decodingImpl protected property
JsonEncoder::$encodingImpl protected property
JsonEncoder::$format protected static property The formats that this Encoder supports.
JsonEncoder::decode public function Decodes a string into PHP data. Overrides DecoderInterface::decode
JsonEncoder::encode public function Encodes data into the given format. Overrides EncoderInterface::encode
JsonEncoder::FORMAT constant
JsonEncoder::getLastDecodingError Deprecated public function Returns the last decoding error (if any).
JsonEncoder::getLastEncodingError Deprecated public function Returns the last encoding error (if any).
JsonEncoder::getLastErrorMessage public static function Resolves json_last_error message.
JsonEncoder::supportsDecoding public function Checks whether the deserializer can decode from given format. Overrides JsonEncoder::supportsDecoding
JsonEncoder::supportsEncoding public function Checks whether the serializer can encode to given format. Overrides JsonEncoder::supportsEncoding
JsonEncoder::__construct public function