You are here

public static function Json::decode in Drupal 9

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Component/Serialization/Json.php \Drupal\Component\Serialization\Json::decode()

Decodes data from the serialization format.

Parameters

string $raw: The raw data string to decode.

Return value

mixed The decoded data.

Throws

\Drupal\Component\Serialization\Exception\InvalidDataTypeException

Overrides SerializationInterface::decode

96 calls to Json::decode()
AssertContentTrait::setRawContent in core/tests/Drupal/KernelTests/AssertContentTrait.php
Sets the raw content (e.g. HTML).
AttachedAssetsTest::testSettings in core/tests/Drupal/KernelTests/Core/Asset/AttachedAssetsTest.php
Tests JavaScript settings.
BasicTest::testViewsWizardAndListing in core/modules/views/tests/src/Functional/Wizard/BasicTest.php
BrowserTestBase::getDrupalSettings in core/tests/Drupal/Tests/BrowserTestBase.php
Gets the JavaScript drupalSettings variable for the currently-loaded page.
BrowserTestBaseTest::testForm in core/tests/Drupal/FunctionalTests/BrowserTestBaseTest.php
Tests basic form functionality.

... See full list

File

core/lib/Drupal/Component/Serialization/Json.php, line 25

Class

Json
Default serialization for JSON.

Namespace

Drupal\Component\Serialization

Code

public static function decode($string) {
  return json_decode($string, TRUE);
}