wp_json_encode
wp_json_encode ( $data, $options = 0, $depth = 512 )
Parameters:- (mixed) data Variable (usually an array or object) to encode as JSON.
- (int) options Optional. Options to be passed to json_encode(). Default 0.
- (int) depth Optional. Maximum depth to walk through $data. 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 sanity checks.