Created
March 25, 2015 19:03
-
-
Save andergmartins/75af77fdf4fa0c075e38 to your computer and use it in GitHub Desktop.
JSON debug
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$json_errors = array( | |
JSON_ERROR_NONE => 'No error has occurred', | |
JSON_ERROR_DEPTH => 'The maximum stack depth has been exceeded', | |
JSON_ERROR_STATE_MISMATCH => 'Invalid or malformed JSON', | |
JSON_ERROR_CTRL_CHAR => 'Control character error, possibly incorrectly encoded', | |
JSON_ERROR_SYNTAX => 'Syntax error', | |
JSON_ERROR_UTF8 => 'Malformed UTF-8 characters, possibly incorrectly encoded (PHP 5.3.3)', | |
JSON_ERROR_RECURSION => 'One or more recursive references in the value to be encoded (PHP 5.5.0)', | |
JSON_ERROR_INF_OR_NAN => 'One or more NAN or INF values in the value to be encoded (PHP 5.5.0)', | |
JSON_ERROR_UNSUPPORTED_TYPE => 'A value of a type that cannot be encoded was given (PHP 5.5.0)' | |
); | |
for ($x=0; $x<strlen($this->row->extra_fields); $x++) { | |
$c = $this->row->extra_fields[$x]; | |
echo '<br/>' . $c . ': ' . ord($c); | |
} | |
echo '<pre>'; | |
$fields = json_decode(html_entity_decode($this->row->extra_fields)); | |
echo ($jerr = json_last_error()) ? $json_errors[$jerr] : 'unknown: ' . (int)$jerr; | |
var_dump($fields); | |
echo '</pre>'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment