How to solve an error “android Error parsing data org.json.JSONException: End of input at character 0 of”?

This forum was posted on Tuesday, March 12, 2013 11:15:59 AM

I am using AsyncTask to parse JSON from server. but i found a issue When I execute my apps. in my logcat my JSON seems good but after that there's an error msg android Error parsing data org.json.JSONException: End of input at char 0 of. I have already attempted little ideas from forums but i was not still get the best approach to fix this. here my code snippet :
protected String doInBackground(String... arg0) {
// TODO Auto-generated method stub
List params = new ArrayList();
JSONObject json = jParser.makeHttpRequest(url_level_detaildatamerchant "GET" params);
Log.d("Get List :" json.toString());
try {
int success = json.getInt(TAG_SUCCESS);
if (success == 1) {
data = json.getJSONArray(TAG_DATA);
for (int i=0; i JSONObject c = data.getJSONObject(i);
Pk_Merchant_ID = c.getString(TAG_Pk_Merchant_ID);
Fk_Ms_DataLevel2_ID = c.getString(TAG_Fk_Ms_DataLevel2_ID);
Fk_Ms_City_ID = c.getString(TAG_Fk_Ms_City_ID);
Fk_Ms_Sales_ID_CreatedBy = c.getString(TAG_Fk_Ms_Sales_ID_CreatedBy);
Fk_Ms_Sales_ID_LastUpdateBy = c.getString(TAG_Fk_Ms_Sales_ID_LastUpdateBy);
CreatedDated = c.getString(TAG_CreatedDated);
LastUpdateDated = c.getString(TAG_LastUpdateDated);
Descriptions = c.getString(TAG_Descriptions);
Address = c.getString(TAG_Address);
Telpon = c.getString(TAG_Telpon);
Handphone = c.getString(TAG_Handphone);
BB_PIN = c.getString(TAG_BB_PIN);
email = c.getString(TAG_email);
Longitude = c.getString(TAG_Longitude);
Latitude = c.getString(TAG_Latitude);
Path_PhotoProfile = c.getString(TAG_Path_PhotoProfile);
Is_Deleted = c.getString(TAG_Is_Deleted);
HashMap map = new HashMap();
map.put(TAG_Pk_Merchant_ID Pk_Merchant_ID);
map.put(TAG_Fk_Ms_DataLevel2_ID Fk_Ms_DataLevel2_ID);
map.put(TAG_Fk_Ms_City_ID Fk_Ms_City_ID);
map.put(TAG_Fk_Ms_Sales_ID_CreatedBy Fk_Ms_Sales_ID_CreatedBy);
map.put(TAG_Fk_Ms_Sales_ID_LastUpdateBy Fk_Ms_Sales_ID_LastUpdateBy);
map.put(TAG_CreatedDated CreatedDated);
map.put(TAG_LastUpdateDated LastUpdateDated);
map.put(TAG_Descriptions Descriptions);
map.put(TAG_Address Address);
map.put(TAG_Telpon Telpon);
map.put(TAG_Handphone Handphone);
map.put(TAG_BB_PIN BB_PIN);
map.put(TAG_email email);
map.put(TAG_Longitude Longitude);
map.put(TAG_Latitude Latitude);
map.put(TAG_Path_PhotoProfile Path_PhotoProfile);
map.put(TAG_Is_Deleted Is_Deleted);
} catch (Exception e) {
// TODO: handle exception
Log.d("Error" e.toString());
return null;

and it's my php :
$response = array();
$koneksi= odbc_connect($dsn $username $password);
if (isset($_POST'Fk_Ms_DataLevel2_ID')) {
$Fk_Ms_DataLevel2_ID = $_POST'Fk_Ms_DataLevel2_ID';
$query = "select * from Ms_Merchant where Fk_Ms_DataLevel2_ID = '$Fk_Ms_DataLevel2_ID' ";
$result = odbc_exec($koneksi $query);
$response "Ms_Merchant" = array();
WHILE ($row = odbc_fetch_array($result)) {
$Ms_Merchant = array();
$Ms_Merchant"Pk_Merchant_ID" = $row "Pk_Merchant_ID";
$Ms_Merchant"Fk_Ms_DataLevel2_ID" = $row "Fk_Ms_DataLevel2_ID";
$Ms_Merchant"Fk_Ms_City_ID" = $row "Fk_Ms_City_ID";
$Ms_Merchant"Fk_Ms_Sales_ID_CreatedBy" = $row "Fk_Ms_Sales_ID_CreatedBy";
$Ms_Merchant"Fk_Ms_Sales_ID_LastUpdateBy" = $row "Fk_Ms_Sales_ID_LastUpdateBy";
$Ms_Merchant"CreatedDated" = $row "CreatedDated";
$Ms_Merchant"LastUpdateDated" = $row "LastUpdateDated";
$Ms_Merchant"Descriptions" = $row "Descriptions";
$Ms_Merchant"Address" = $row "Address";
$Ms_Merchant"Telpon" = $row "Telpon";
$Ms_Merchant"Handphone" = $row "Handphone";
$Ms_Merchant"BB_PIN" = $row "BB_PIN";
$Ms_Merchant"email" = $row "email";
$Ms_Merchant"Longitude" = $row "Longitude";
$Ms_Merchant"Latitude" = $row "Latitude";
$Ms_Merchant"Path_PhotoProfile" = $row "Path_PhotoProfile";
$Ms_Merchant"Is_Deleted" = $row "Is_Deleted";
array_push($response"Ms_Merchant" $Ms_Merchant);
$response"success" = 1;
echo json_encode($response);

i require your all of your helps. Thnk u for advance.

 Views 197 Get Source Code >>
Related Tags:

Replies on "How to solve an error “android Error parsing data org.json.JSONException: End of input at character 0 of”?" :

Nobody has replied on this post , be first to post answer.

Post Your Answer/Comment:

Please Login first to post Reply !

Note: Please Put Code into <code></code> block.

Threads related to "How to solve an error “android Error parsing data org.json.JSONException: End of input at character 0 of”?":