Q: How to parse all JSON values correctly in Android First the: Android Code   
public class MachineController extends AsyncTask<String, String,List<Machine>> {

private static String REST_URL = "...";
List<Machine> machines;


@Override
protected List<Machine> doInBackground(String... params) {
    machines = new ArrayList<Machine>();


    HttpClient httpClient = new DefaultHttpClient();
    HttpGet httpGet = new HttpGet(REST_URL);
    httpGet.addHeader("accept", "application/json");

    HttpResponse response;
    try {
        response = httpClient.execute(httpGet);
        HttpEntity entity = response.getEntity();

        if (entity != null) {
            InputStream instream = entity.getContent();

            BufferedReader reader = new BufferedReader(new InputStreamReader(instream));
            StringBuilder sb = new StringBuilder();
            String line = null;

            while ((line = reader.readLine()) != null)
                sb.append(line + "n");

            String result = sb.toString();


            Gson gson = new Gson();
            JsonReader jsonReader = new JsonReader(new StringReader(result));
            jsonReader.setLenient(true);

            JsonParser parser = new JsonParser();
            JsonArray jsonArray = parser.parse(jsonReader).getAsJsonArray();

            for (JsonElement obj : jsonArray) {
                Machine machine = gson.fromJson(obj.getAsJsonObject().get("mobileMachine"), Machine.class);
                machines.add(machine);
                machines.get(0);

            }

            instream.close();

        }
    } catch (ClientProtocolException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    }
    return machines;
}

}
Here is some Code of the JSON File
 [ 
{ "mobileMachine": 
{ "condition":"VERY_GOOD",
 "document":"", . . .
 "mobileCategory": {   "idNr":"1816e5697eb3e0c8442786be5274cb05cff04c06b4338467c8679770bff32313f7f372b5ec2f7527dad0de47d0fb117e",
 "mobileCategoryEng":"Bookletmaker",
 "mobileCategoryGer":"Broschuerenfertigung" }, 
"modelYear":2006, 
Abmessungen: 665x810mm " } }

{ "mobileMachine": 
{
     "condition":"VERY_GOOD"," ...... } } ]

Sometimes there is a mobileCategory inside. The mobileCategoryGer and mobileCategoryEng are allways null in the List.
I can't edit the JSON File! I only want the value for mobileCategoryGer and mobileCategoryEng  from the Json File. The Rest works fine. I hope u understand and can help me to parse it correctly.
(Sorry for my english)

A: Here you go.
    Type listType = new TypeToken<List<Machine>>() {}.getType();
    ArrayList<Result> results = gson.fromJson(result, listType);

Here is your complete modified code:
  public class MachineController extends AsyncTask<String, String,List<Machine>> {

     private static String REST_URL = "...";
     List<Machine> machines;


     @Override
   protected List<Machine> doInBackground(String... params) {

    HttpClient httpClient = new DefaultHttpClient();
    HttpGet httpGet = new HttpGet(REST_URL);
    httpGet.addHeader("accept", "application/json");

   HttpResponse response;
   try {
    response = httpClient.execute(httpGet);
    HttpEntity entity = response.getEntity();

    if (entity != null) {
        InputStream instream = entity.getContent();

        BufferedReader reader = new BufferedReader(new InputStreamReader(instream));
        StringBuilder sb = new StringBuilder();
        String line = null;

        while ((line = reader.readLine()) != null)
            sb.append(line + "n");

        String result = sb.toString();


        Gson gson = new Gson();

       Type listType = new TypeToken<List<Machine>>() {}.getType();
       machines= gson.fromJson(result, listType);

        instream.close();

    }
} catch (ClientProtocolException e) {
    e.printStackTrace();
} catch (IOException e) {
    e.printStackTrace();
}
return machines;

}

A: You could check if it has the key with has() method. Also you can get optional value with optJSONObject() and check if it is not null.
JsonArray jsonArray = parser.parse(jsonReader).getAsJsonArray();
try {
    doSomething(jsonArray);
} catch (JSONException e) {  
   Log.wtf("Terrible Failure", e);
}


private void doSomething(JsonArray jsonArray) throws JSONException{
        for (int i=0; i<jsonArray.length(); i++){
            JSONObject obj = jsonArray.getJSONObject(i);
            JSONObject mobileCategory = obj.optJSONObject("mobileCategory");
            if(mobileCategory !=null){
                if(mobileCategory.has("mobileCategoryEng") && mobileCategory.has("mobileCategoryGer") ){
                    String mobileCategoryEng = mobileCategory.getString("mobileCategoryEng");
                    String mobileCategoryGer = mobileCategory.getString("mobileCategoryGer");
                }
            }
        }
    }

