Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. functions.php

function json_decode

Wrapper for json_decode that throws when an error occurs.

Parameters

string $json JSON data to parse:

bool $assoc When true, returned objects will be converted: into associative arrays.

int $depth User specified recursion depth.:

int $options Bitmask of JSON decode options.:

Return value

object|array|string|int|float|bool|null

Throws

Exception\InvalidArgumentException if the JSON cannot be decoded.

Deprecated

json_decode will be removed in guzzlehttp/guzzle:8.0. Use Utils::jsonDecode instead.

See also

https://www.php.net/manual/en/function.json-decode.php

64 calls to json_decode()
AbstractWebDriver::curl in vendor/lullabot/php-webdriver/lib/WebDriver/AbstractWebDriver.php
Curl request to webdriver server.
Application::doRun in vendor/composer/composer/src/Composer/Console/Application.php
Runs the current application.
AttributeParser::forMethod in vendor/phpunit/phpunit/src/Metadata/Parser/AttributeParser.php
@psalm-param class-string $className @psalm-param non-empty-string $methodName
BaseConstraint::arrayToObjectRecursive in vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/BaseConstraint.php
Recursively cast an associative array to an object
BulkForm::loadEntityFromBulkFormKey in core/modules/views/src/Plugin/views/field/BulkForm.php
Loads an entity based on a bulk form key.

... See full list

1 string reference to 'json_decode'
DiagnoseCommand::checkPlatform in vendor/composer/composer/src/Composer/Command/DiagnoseCommand.php

File

vendor/guzzlehttp/guzzle/src/functions.php, line 147

Namespace

GuzzleHttp

Code

function json_decode(string $json, bool $assoc = false, int $depth = 512, int $options = 0) {
    return Utils::jsonDecode($json, $assoc, $depth, $options);
}
RSS feed
Powered by Drupal