I'm creating a sample using the concepts JSONArray parse to get particular values to match the attributes.

For example:

*sample\_struct.json* file data 

```
 [ {
 "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"  }]

```

My need is to get "mDk" where the string "kk" to listout within both query and location value also to display it.

```
String mmm = "kk";

JSONArray jsonArray=getJSonData("sample_struct.json");
parseData(jsonArray);

private void parseData(JSONArray array) {
    for(int i = 0; i < 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();
        }
    }
}

```

Without displaying the null values.