title: How to match attributes JSON object values to using Android or Java?
body: <p>I'm creating a sample using the concepts JSONArray parse to get particular values to match the attributes.</p>
  
  <p>For example:</p>
  
  <p><em>sample_struct.json</em>  file data </p>
  
  <pre><code> [ {
   "query": "Pizza",
   "locations": [94043,90210]
   "mDK": "kk"
  
         }, {
   "query": "Pizza",
   "locations": [94043,90210]
         }, {
   "query": "akkk",
   "locations": [94043,90210]
         }, {
   "query": "Pizza",
   "locations": [94043,90210], 
   "mDK": "kk"
         }, {
   "query": "Pizza",
   "locations": [94043,90210],"mDK": "ff"
         }, {
   "query": "Pigg",
   "locations": [94043,90210],"mDK": "kk"
         }, {
   "query": "Pgg",
   "locations": [94043,90210],"mDK": "ff"  }, {
   "query": "Pgg",
   "locations": [94043,90210],"mDK": "ff"  }, {
   "query": "Pgg",
   "locations": [94043,90210],"mDK": "ff"  }, {
   "query": "Pgg",
   "locations": [94043,90210],"mDK": "kk"  }]
  </code></pre>
  
  <p>My need is to get "mDk" where the string "kk" to listout within both query and location value also to display it.</p>
  
  <pre><code>String mmm = "kk";
  
  JSONArray jsonArray=getJSonData("sample_struct.json");
  parseData(jsonArray);
  
  private void parseData(JSONArray array) {
      for(int i = 0; i &lt; array.length(); i++) {
          Mo mo = new Mo();
          JSONObject json = null;
  
          try {
              json = array.getJSONObject(i);
  
              if(json.get("mDK").equals(mm)) {
  
                  mo.setquery(json.getString("query"));
                  mo.setlocations(json.getString("locations));
                  mo.setmDK(json.getString("mDk"));
              }
  
          } catch (JSONException e) {
              e.printStackTrace();
          }
      }
  }
  </code></pre>
  
  <p>Without displaying the null values.</p>