Oppure

Loading
17/04/18 15:01
domenico_rizzo
Ciao allora la mia app fa una richiesta http, e ottenendo il json di risposta vorrei poter creare oggetti secondo mie necessita'.. ma inspiegabilmente mi crasha mentre ottengo il parse del JSON dalla richiesta mentre cerco di ottenere informazioni :_doubt:

risposta json:
[
	{
		"id":1,
		"str1":2,
		"str2":null,
		"str3":"ss1",
		"str4":null,
		"str5":12.34566789,
		"str6":98.76543210,
		"str7":0, 
		data: [
			{
				"id":3,
				"str8":4,
				"str9":5,
				"str10":"ss2",
				"str11":"ss3",
				"str12":null,
				"str13":null,
				"str14":1, 
				data: [
					{
						"id":6,
						"str15":7,
						"str16":8,
						"str17":"ss4",
						"str18":"ss5",
						"str19":null,
						"str20":null,
						"str21":2
					}, 
					{
						"id":9,
						"str22":10,
						"str23":11,
						"str24":"ss6",
						"str25":"ss7",
						"str26":null,
						"str27":null,
						"str28":2
					}
				]
			}, 
			{
				"id":12,
				"str29":13,
				"str30":14,
				"str31":"ss8",
				"str32":"ss9",
				"str33":null,
				"str34":null,
				"str35":1, 
				data: [
					{
						"id":15,
						"str35":16,
						"str36":17,
						"str37":"ss10",
						"str38":"ss11",
						"str39":null,
						"str40":null,
						"str41":2
					}, 
					{
						"id":18,
						"str42":19,
						"str43":20,
						"str44":"ss12",
						"str45":"ss13",
						"str46":null,
						"str47":null,
						"str48":2
					}
				]
			}
		]
	}
]


richiamo una funzione in cui vorrei gestire il risultato della chiamata json:
//prepareList( new JSONObject(string_json) ); chiamo in questo modo la suddetta funzione

private void prepareList(JSONObject jso) throws JSONException {
        Log.d("RESULT", jso.toString());
        int id = jso.getInt("id");
        int str1 = jso.getInt("str1");
        Log.d("RESULT", id+"\n"+str1);
}


Sapreste aiutarmi?? :d
Ultima modifica effettuata da domenico_rizzo 17/04/18 15:28
aaa
30/04/18 12:11
tuttodiMC
Potresti recuperare il nome dell'eccezione che viene creata?
aaa
30/04/18 12:11
tuttodiMC
Potresti recuperare il nome dell'eccezione che viene creata?
aaa