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

Breadcrumb

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

function json_encode

Wrapper for JSON encoding that throws when an error occurs.

Parameters

mixed $value The value being encoded:

int $options JSON encode option bitmask:

int $depth Set the maximum depth. Must be greater than zero.:

Throws

Exception\InvalidArgumentException if the JSON cannot be encoded.

Deprecated

json_encode will be removed in guzzlehttp/guzzle:8.0. Use Utils::jsonEncode instead.

See also

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

76 calls to json_encode()
AbstractBrowser::jsonRequest in vendor/symfony/browser-kit/AbstractBrowser.php
Converts the request parameters into a JSON string and uses it as request content.
AbstractWebDriver::curl in vendor/lullabot/php-webdriver/lib/WebDriver/AbstractWebDriver.php
Curl request to webdriver server.
ArrayLoader::configureObject in vendor/composer/composer/src/Composer/Package/Loader/ArrayLoader.php
ArrayLoader::createObject in vendor/composer/composer/src/Composer/Package/Loader/ArrayLoader.php
@template PackageClass of CompletePackage
BaseConstraint::arrayToObjectRecursive in vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/BaseConstraint.php
Recursively cast an associative array to an object

... See full list

2 string references to 'json_encode'
BaseIO::log in vendor/composer/composer/src/Composer/IO/BaseIO.php
CoreExtension::getFilters in vendor/twig/twig/src/Extension/CoreExtension.php
Returns a list of filters to add to the existing list.

File

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

Namespace

GuzzleHttp

Code

function json_encode($value, int $options = 0, int $depth = 512) : string {
    return Utils::jsonEncode($value, $options, $depth);
}
RSS feed
Powered by Drupal