wp_json_encode


wp_json_encode ( $value, $flags = 0, $depth = 512 )

Parameters:
  • (mixed) value Variable (usually an array or object) to encode as JSON.
  • (int) flags Optional. Options to be passed to json_encode(). Default 0.
  • (int) depth Optional. Maximum depth to walk through $value. Must be greater than 0. Default 512.
Returns:
  • (string|false) The JSON encoded string, or false if it cannot be encoded.
Defined at:
Change Log:
  • 5: .
  • 6: .

Description

Encodes a variable into JSON, with some confidence checks.

Related Functions

wp_json_file_decode, wp_send_json_error, wp_is_json_media_type, wp_is_json_request, wp_encode_emoji

Top Google Results

User discussions

wpseek mobile