is_json ( $s )

Determines whether the data is a JSON string or not.

Access

public

Parameters

Parameter

Type

Required

Description

$s

string

Required

The string to test.

Returns

Type

Description

boolean

Whether the string is a valid JSON object or not.

Source

Method defined in utilities/utilities.class.php | Toggle source view (4 lines) | View on GitHub

public function is_json($s)
{
    return !!(json_decode($s) instanceof stdClass);
}

Copyright © 2010–2013 Amazon Web Services, LLC


Feedback