Services_JSON::encode() – encodes an arbitrary variable into JSON format (and sends JSON Header)

You appear to be a bot. Output may be restricted

Description

encodes an arbitrary variable into JSON format (and sends JSON Header)

Usage

Services_JSON::encode( $var );

Parameters

$var
( mixed ) required – any number, boolean, string, array, or object to be encoded. see argument 1 to Services_JSON() above for array-parsing behavior. if var is a string, note that encode() always expects it to be in ASCII or UTF-8 format!

Returns

void mixed JSON string representation of input var or an error if a problem occurs

Source

File name: wordpress/wp-includes/class-json.php


Lines:

1 to 8 of 8
    function encode($var)
    {
        _deprecated_function( __METHOD__, '5.3.0', 'The PHP native JSON extension' );

        header('Content-Type: application/json');
        return $this->Services_JSON::encodeUnsafe($var);
    }
 

 View on GitHub View on Trac