I have a problem with the json_decode()
when passed string contain "&". When mobile app send a request as a post containing this type of a UTF encoded string:
[
{
"mobile": [
"123456"
],
"full_name": [
"Bride&Groom"
]
}
json_decode()
a null array. This happens when only send the request through the mobile end. specific scenario? We are using Laravel 5.
Request taken like this $friendDetails = $request->friend
then pass the variable through json_decode
$decodedFriend = json_decode($friendDetails ,true);
As headers we are using Oauth and header values are like this.
Authorization Bearer <token>
Content type is application form data
Thanks in advance
I just tried with json_decode
function and the string you gave as example is perfectly decoded to:
object(stdClass)#1 (2) {
["mobile"]=>
array(1) {
[0]=>
string(6) "123456"
}
["full_name"]=>
array(1) {
[0]=>
string(11) "Bride&Groom"
}
}
Consider adding a MCVE