7 methods override SerializationInterface::encode()

Json::encode in core/lib/Drupal/Component/Serialization/Json.php
Uses HTML-safe strings, with several characters escaped.
PhpSerialize::encode in core/lib/Drupal/Component/Serialization/PhpSerialize.php
Encodes data into the serialization format.
Yaml::encode in core/lib/Drupal/Component/Serialization/Yaml.php
Encodes data into the serialization format.
YamlParserProxy::encode in core/tests/Drupal/Tests/Core/Serialization/YamlTest.php
Encodes data into the serialization format.
YamlParserProxy::encode in core/tests/Drupal/Tests/Component/Serialization/YamlTest.php
Encodes data into the serialization format.
YamlPecl::encode in core/lib/Drupal/Component/Serialization/YamlPecl.php
Encodes data into the serialization format.
YamlSymfony::encode in core/lib/Drupal/Component/Serialization/YamlSymfony.php
Encodes data into the serialization format.

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