Practical JSON codes
PHP:
/**
* Is this JSON Code
* @param string $input Input data
* @return boolean JSON: 1, else 0.
*/
function is_json($input)
{
if(is_string($input) === false)
{
return false;
}
json_decode($input);
return json_last_error() == JSON_ERROR_NONE;
}
Code (Text):
/**
* Reshape JSON data for readibility
*
* @param string $json input data
*
* @param array $options
*
* @return string Output data
*/
function json_pretty_print($data, $options =…
Practical JSON codes
See original post by replaz.com
Leave a Reply
You must be logged in to post a comment.