PHP json_decode returns null value for valid json - WebSecuritySpecialist

Sunday, 6 August 2017

PHP json_decode returns null value for valid json

PHP json_decode returns null value for valid json

Valid json string when decoded returns the null value or empty value.

You can validate your JSON string on - JSON LINT https://jsonlint.com/
JSON string might contains the encoding of the special characters.

You can now json_decode your string with -

json_decode( preg_replace('/[\x00-\x1F\x80-\xFF]/', '', $json_string), true );

Hope this will work !! 

No comments:

Post a Comment