You are here

public static function JWT::jsonEncode in Auth0 Single Sign On 8.2

Encode a PHP object into a JSON string.

Parameters

object|array $input A PHP object or array:

Return value

string JSON representation of the PHP object or array

Throws

DomainException Provided object could not be encoded to valid JSON

4 calls to JWT::jsonEncode()
JWT::encode in vendor/firebase/php-jwt/src/JWT.php
Converts and signs a PHP object or array into a JWT string.
TokenTest::testSuccessfulRs256TokenDecoding in vendor/auth0/auth0-php/tests/API/Helpers/TokenGeneratorTest.php
Test a successful RS256 token decoding.
TokenTest::testThatTokenWithBadAlgThrowsException in vendor/auth0/auth0-php/tests/API/Helpers/TokenGeneratorTest.php
Test that a malformed token or missing algorithm fails.
TokenTest::testThatTokenWithInvalidAudThrowsException in vendor/auth0/auth0-php/tests/API/Helpers/TokenGeneratorTest.php
Test that an invalid audience is rejected.

File

vendor/firebase/php-jwt/src/JWT.php, line 315

Class

JWT
JSON Web Token implementation, based on this spec: https://tools.ietf.org/html/rfc7519

Namespace

Firebase\JWT

Code

public static function jsonEncode($input) {
  $json = \json_encode($input);
  if ($errno = \json_last_error()) {
    static::handleJsonError($errno);
  }
  elseif ($json === 'null' && $input !== null) {
    throw new DomainException('Null result with non-null input');
  }
  return $json;
}