You are here

function json_encode in Auth0 Single Sign On 8.2

Wrapper for JSON encoding that throws when an error occurs.

@link http://www.php.net/manual/en/function.json-encode.php

Parameters

mixed $value The value being encoded:

int $options JSON encode option bitmask:

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

Return value

string

Throws

Exception\InvalidArgumentException if the JSON cannot be encoded.

File

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

Namespace

GuzzleHttp

Code

function json_encode($value, $options = 0, $depth = 512) {
  $json = \json_encode($value, $options, $depth);
  if (JSON_ERROR_NONE !== json_last_error()) {
    throw new Exception\InvalidArgumentException('json_encode error: ' . json_last_error_msg());
  }
  return $json;
}