2016-04-11 21 views
0
protected void onPostExecute(JSONObject json) 
     { 
     if (pDialog != null && pDialog.isShowing()) 
     { 
      pDialog.dismiss(); 
     } 

     if (json != null) 
     { 
      //Toast.makeText(Home.this, json.toString(), Toast.LENGTH_LONG).show(); 

      Toast.makeText(getApplicationContext(),"Login successfully !!!!",Toast.LENGTH_SHORT).show(); 
      //startActivity(new Intent(Home.this, NewWelcome.class)); 

     } 
     else 
     { 
      Toast.makeText(getApplicationContext(),"Wrong user and password",Toast.LENGTH_SHORT).show(); 
     } 
    } 

Kullanıcı adı gibi "JSONObject json" dan veri okumak ve dizi değişkenine depolamak istiyorum lütfen bana yardım edin! json nesnesi verijson ayrıştırıcısından veri okuma

ise Json nesnesi

"{ 
    "0": 8, 
    "S_No": 8, 
    "1": "Sachin Palve", 
    "User_name": "Sachin Palve", 
    "2": "[email protected]", 
    "Email_id": "[email protected]", 
    "3": "12345", 
    "Password": "12345", 
    "4": "Pune", 
    "Place": "Pune", 
    "5": "9860629293", 
    "Contact_no": "9860629293", 
    "6": "yes", 
    "TC_approve": "yes", 
    "7": "SPU93008", 
    "User_id": "SPU93008" 
}" 

cevap

0

bu veriler gibi

böyle javascript birşeyden okuyorlar eğer

, alanlara 0 erişim S_No

alacak $ var1 = json.0; $ var2 = json.S_No; vb ... değil kaçmak çift tırnak tek tırnak nesneye

0

ödeme dikkat

var jsonStringData = '{ "0": 8, "S_No": 8, "1": "Sachin Palve", "User_name": "Sachin Palve", "2": "[email protected]", "Email_id": "[email protected]", "3": "12345", "Password": "12345", "4": "Pune", "Place": "Pune", "5": "9860629293", "Contact_no": "9860629293", "6": "yes", "TC_approve": "yes", "7": "SPU93008", "User_id": "SPU93008" }'; 
 

 
var dataobj = JSON.parse(jsonStringData); 
 
console.log(dataobj);