You can't do that with your current object. You have to change the type of the JSONObject you're appending to. As noted in the comments, you actually just want to serialize an array of custom objects.
Therefore, create a JsonArray as described in this answer: JSONObject.append into object - result is nested array?
Java is not my first language, but maybe this will help you out:
//First create the name and language object
JSONObject nameLanguageObj = new JSONObject();
nameLanguageObj.add("name","first");
nameLanguageObj.add("language","English");
//Create the array to hold the objects
JSONArray arr = new JSONArray();
arr.put(nameLanguage);
//Create the full class object as you requested.
JSONObject classObj = new JSONObject();
classObj.put("class", arr);