Code example for Gson

Methods: fromJson

0
		// Create a response handle 
		ResponseHandler<String> responseHandler = new BasicResponseHandler();
		String responseBody = ""; /*!<Store response from server*/
		try { 
			responseBody = httpclient.execute(httpget, responseHandler); 
			Gson gson = new Gson();
			Data obj = new Data();
			obj = gson.fromJson(responseBody, Data.class); /*!<Parse through JSON that is returned*/
			hotspots = obj.getHotspots(); 
		}catch(Exception e){
			Toast.makeText(ConnectorService.this, "Server is unreachable...", Toast.LENGTH_LONG);
			System.exit(-1);
		} 
 
		//Close connection 
		httpclient.getConnectionManager().shutdown();
	} 
	/* 
	 * @author Rohan Balakrishnan 
	 *  
Connect your IDE to all the code out there  Get Codota for Java