Simple but effective tips to prevent android/iphone application crash for backend developer

Hi Guys,

For any application(mobile app) usually get data from back end. And if backend is developed using PHP(may be framework) then sample API response will be like following.


You can see that json response contains “null” in some place.. So parsing from Iphone/Android application got crashed.

simple and effective solution for this is use str_replace PHP function and replace “null” with “”.


$a =  json_string;

$b = str_replace(“null”,’ “” ‘,$a);

so the value of $b looks like following.

Updated json response

Its looking very simple but its very useful tips.







Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s