class Json
Same name in this branch
- 11.1.x vendor/phpunit/phpunit/src/Util/Json.php \PHPUnit\Util\Json
- 11.1.x vendor/symfony/validator/Constraints/Json.php \Symfony\Component\Validator\Constraints\Json
- 11.1.x vendor/squizlabs/php_codesniffer/src/Reports/Json.php \PHP_CodeSniffer\Reports\Json
Default serialization for JSON.
Hierarchy
- class \Drupal\Component\Serialization\Json implements \Drupal\Component\Serialization\SerializationInterface
Expanded class hierarchy of Json
Related topics
- REST and Application Integration
- Integrating third-party applications using REST and related operations.
35 files declare their use of Json
- ActiveLinkResponseFilter.php in core/
lib/ Drupal/ Core/ EventSubscriber/ ActiveLinkResponseFilter.php - AllowedScaffoldPackagesValidator.php in core/
modules/ package_manager/ src/ Validator/ AllowedScaffoldPackagesValidator.php - AnnounceFetcher.php in core/
modules/ announcements_feed/ src/ AnnounceFetcher.php - BlockLibraryController.php in core/
modules/ block/ src/ Controller/ BlockLibraryController.php - BlockListBuilder.php in core/
modules/ block/ src/ BlockListBuilder.php
28 string references to 'Json'
- CheckPlatformReqsCommand::printTable in vendor/
composer/ composer/ src/ Composer/ Command/ CheckPlatformReqsCommand.php - ConfigCommand::execute in vendor/
composer/ composer/ src/ Composer/ Command/ ConfigCommand.php - default_language.yml in core/
modules/ language/ migrations/ default_language.yml - core/modules/language/migrations/default_language.yml
- DiagnoseCommand::checkPlatform in vendor/
composer/ composer/ src/ Composer/ Command/ DiagnoseCommand.php - Endpoint::__construct in core/
modules/ media/ src/ OEmbed/ Endpoint.php - Endpoint constructor.
File
-
core/
lib/ Drupal/ Component/ Serialization/ Json.php, line 10
Namespace
Drupal\Component\SerializationView source
class Json implements SerializationInterface {
/**
* {@inheritdoc}
*
* Uses HTML-safe strings, with several characters escaped.
*/
public static function encode($variable) {
// Encode <, >, ', &, and ".
return json_encode($variable, JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_AMP | JSON_HEX_QUOT);
}
/**
* {@inheritdoc}
*/
public static function decode($string) {
return json_decode($string, TRUE);
}
/**
* {@inheritdoc}
*/
public static function getFileExtension() {
return 'json';
}
}
Members
Title Sort descending | Modifiers | Object type | Summary | Overriden Title |
---|---|---|---|---|
Json::decode | public static | function | Decodes data from the serialization format. | Overrides SerializationInterface::decode |
Json::encode | public static | function | Uses HTML-safe strings, with several characters escaped. | Overrides SerializationInterface::encode |
Json::getFileExtension | public static | function | Gets the file extension for this serialization format. | Overrides SerializationInterface::getFileExtension |