Services_JSON::name_value()publicWP 1.0

Deprecated from version 5.3.0. It is no longer supported and can be removed in future releases. Use PHP native JSON extension instead.

array-walking function for use in generating JSON-formatted name-value pairs

{} It's a method of the class: Services_JSON{}

No Hooks.


String. JSON-formatted name-value pair, like '"name":value'


$Services_JSON = new Services_JSON();
$Services_JSON->name_value( $name, $value );
$name(string) (required)
name of key to use
$value(mixed) (required)
reference to an array element to be encoded


Deprecated Since 5.3.0 Use the PHP native JSON extension instead.

Code of Services_JSON::name_value() WP 6.0

function name_value($name, $value)
    _deprecated_function( __METHOD__, '5.3.0', 'The PHP native JSON extension' );

    $encoded_value = $this->_encode($value);

    if(Services_JSON::isError($encoded_value)) {
        return $encoded_value;

    return $this->_encode((string) $name) . ':' . $encoded_value;