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: - Introduced in WordPress: 4.1.0
- Deprecated in WordPress: —
Description
Encodes a variable into JSON, with some confidence checks.