Skip to content Skip to sidebar Skip to footer

I Trying To Send This Json Data Form Android To Php Server

I trying to send this json data form android to php server. this my json data{email:'user111@gmail.com',password:'00000'}, any one help how the decode this json data in php server

Solution 1:

If $_POST['params'] is a JSON encoded string, you only have to call json_decode once, not the multiple times that you have shown.

$decoded = json_decode($_POST['params'], true);
// Decoded is now an array of the JSON data$email = $decoded['email'];
$pass = $decoded['password'];

It should be noted that the string in your question is not valid JSON, as email and password need to be quoted, as well.

You can do live testing of the json_decode function here: http://php.fnlist.com/php/json_decode

You can validate your JSON here: http://jsonlint.com

Post a Comment for "I Trying To Send This Json Data Form Android To Php Server"