title: How to Fetch a Single Random JSONObject from JSON Array
body: <p>This is My JSON Array with Different Quotes along with their Author Name.</p>
  
  <pre><code> {
    "quotes": [
      {
        "id": "4",
        "quote": "whatsapp is bad",
        "author": "William W. Purkey "
      },
      {
        "id": "3",
        "quote": "yahoo is a company",
        "author": "William W. Purkey "
      },
      {
        "id": "1",
        "quote": "Google is a search engine",
        "author": "William W. Purkey "
      }
    ]
  }
  </code></pre>
  
  <p>I want to Fetch a Single Random JSON Object inside android. Instead of whole things.</p>
  
  <p>Example : </p>
  
  <pre><code> {
    "id": "4",
    "quote": "whatsapp is bad",
    "author": "William W. Purkey "
  }
  </code></pre>
  
  <p>This is What I'm Getting Now in my Android App:
  <a href="https://i.stack.imgur.com/MY4Of.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/MY4Of.png" alt="Getting All JSON Object from Array"></a></p>
  
  <p>Here is my MainActivity.java</p>
  
  <pre><code>    public class MainActivity extends AppCompatActivity {
      private TextView quoteTV, authorTV, startReading;
     // private RequestQueue mQueue;
      private ProgressDialog progress;
      public RequestQueue mQueue;
  
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
  
          startReading = findViewById(R.id.startReading);
          quoteTV = findViewById(R.id.quoteTV);
          quoteTV.setVerticalScrollBarEnabled(true);
          quoteTV.setMovementMethod(ScrollingMovementMethod.getInstance());
          quoteTV.setScrollBarStyle(View.SCROLLBARS_INSIDE_INSET);
          authorTV = findViewById(R.id.authorTV);
          final Button buttonParse = findViewById(R.id.button_parse);
  
          mQueue = Volley.newRequestQueue(this);
  
          CardView editProfileLayout = (CardView) findViewById(R.id.authorTVBG);
          editProfileLayout.setVisibility(View.GONE);
  
          buttonParse.setText("Start Reading");
  
          buttonParse.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
  
                  buttonParse.setText("Next Quote");
                  CardView editProfileLayout = (CardView) findViewById(R.id.authorTVBG);
                  editProfileLayout.setVisibility(View.VISIBLE);
                  quoteTV.setText("");
                  authorTV.setText("");
  
  
                  progress = new ProgressDialog(MainActivity.this);
                  progress.setMessage("Loading.. Please Wait");
                  progress.setCancelable(true);
                  progress.show();
  
                  jsonParse();
                  startReading.setText("");
              }
          });
      }
  
      private void jsonParse() {
  
          String url = "http://myjson.com/q3wr4";
  
          JsonObjectRequest request = new JsonObjectRequest(Request.Method.GET, url, null,
                  new Response.Listener&lt;JSONObject&gt;() {
  
                      @Override
                      public void onResponse(JSONObject response) {
                          try {
                              JSONArray jsonArray = response.getJSONArray("quotes");
  
                              for (int i = 0; i &lt; jsonArray.length(); i++) {
                                  JSONObject quotes = jsonArray.getJSONObject(i);
  
                                  int id = quotes.getInt("id");
                                  String quote = quotes.getString("quote");
                                  String author = quotes.getString("author");
  
                                  progress.hide();
  
                                  quoteTV.append("“ " + String.valueOf(quote) + " ”");
                                  authorTV.append("Author " + ": " + String.valueOf(author));
  
                              }
                          } catch (JSONException e) {
                              e.printStackTrace();
                          }
                      }
                  }, new Response.ErrorListener() {
              @Override
              public void onErrorResponse(VolleyError error) {
                  error.printStackTrace();
              }
          });
  
          mQueue.add(request);
  
      }
  }
  </code></pre>
  
  <p>I Need to Show Only One Quote in my android app instead of showing all Quotes from JSON Array. Need help. Thanks in Advance</p>