title: Get JSON Data from URL Using Android?
body: <p>I am trying to get JSON data by parsing login url with username and password. I have tried by using below code but I can't get any responses. Please help me.</p>
  
  <p>I am using HTTP Process and API level 23.</p>
  
  <p>I need to parse my URL and get below Response </p>
  
  <pre><code>{
      "response":{
                  "Team":"A",
                  "Name":"Sonu",
                  "Class":"First",
                },
                  "Result":"Good",
  }
  </code></pre>
  
  <p>Below My code :</p>
  
  <pre><code>public class LoginActivity extends Activity {
  
      JSONParser jsonparser = new JSONParser();
      TextView tv;
      String ab;
      JSONObject jobj = null;
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.login);
  
          new retrievedata().execute();
  
      }
  
      class retrievedata extends AsyncTask&lt;String, String, String&gt;{
  
          @Override
          protected String doInBackground(String... arg0) {
              // TODO Auto-generated method stub
              jobj = jsonparser.makeHttpRequest("http://myurlhere.com");
  
              // check your log for json response
              Log.d("Login attempt", jobj.toString());
  
              try {
                  ab = jobj.getString("title");
              } catch (JSONException e) {
                  // TODO Auto-generated catch block
                  e.printStackTrace();
              }
              return ab;
          }
          protected void onPostExecute(String ab){
  
              tv.setText(ab);
          }
  
      }
  
  }
  </code></pre>