src/main/java/com/github/jreddit/parser/listing/RedditListingParser.java
public List<Thing> parseGeneric(String jsonText, String listingName) throws RedditParseException {
        
        try {
        
            // List of submissions
            List<Thing> things = new LinkedList<Thing>();
            
            // Send request to reddit server via REST client
            Object response = JSON_PARSER.parse(jsonText);
            
            // Check for reddit error, can throw a RedditError
            validate(response);
            
            // Cast to a JSON object
            JSONObject object = (JSONObject) response;
            
            // Get the array of children
            JSONArray array = (JSONArray) ((JSONObject) object.get("data")).get(listingName);
    
            // Iterate over array of children
            for (Object element : array) {
                
                // Get the element
                JSONObject data = (JSONObject) element;
                
                // Make sure it is of the correct kind
                String kindData = safeJsonToString(data.get("kind"));
                Object objData = data.get("data");
                
                // If no kind is given
                if (kindData == null) {
                    LOGGER.warn("Kind data missing, skipping it.");
                    
                // If no data is given
                } else if (objData == null || !(objData instanceof JSONObject)) {
                    LOGGER.warn("Object data missing, skipping it.");
                    
                } else {
                    
                    // Attempt to match
                    Kind kind = Kind.match(kindData);
                    
                    // Parse the thing
                    Thing thing = parseThing(kind, ((JSONObject) data.get("data")));
                    
                    // Show warning if failed
                    if (thing == null) {
                        LOGGER.warn("Encountered invalid kind for a listing (" + kindData + "), skipping it.");
    
                    } else {
                        things.add(thing);
                    }
                    
                }
                
            }
            
            // Finally return list of submissions 
            return things;
        
        } catch (ParseException pe) {
            throw new RedditParseException(pe);
        }
        
    }
public List<Thing> parseGeneric(String jsonText, String listingName) throws RedditParseException {
        
        try {
        
            // List of submissions
            List<Thing> things = new LinkedList<Thing>();
            
            // Send request to reddit server via REST client
            Object response = JSON_PARSER.parse(jsonText);
            
            // Check for reddit error, can throw a RedditError
            validate(response);
            
            // Cast to a JSON object
            JSONObject object = (JSONObject) response;
            
            // Get the array of children
            JSONArray array = (JSONArray) ((JSONObject) object.get("data")).get(listingName);
    
            // Iterate over array of children
            for (Object element : array) {
                
                // Get the element
                JSONObject data = (JSONObject) element;
                
                // Make sure it is of the correct kind
                String kindData = safeJsonToString(data.get("kind"));
                Object objData = data.get("data");
                
                // If no kind is given
                if (kindData == null) {
                    LOGGER.warn("Kind data missing, skipping it.");
                    
                // If no data is given
                } else if (objData == null || !(objData instanceof JSONObject)) {
                    LOGGER.warn("Object data missing, skipping it.");
                    
                } else {
                    
                    // Attempt to match
                    Kind kind = Kind.match(kindData);
                    
                    // Parse the thing
                    Thing thing = parseThing(kind, ((JSONObject) data.get("data")));
                    
                    // Show warning if failed
                    if (thing == null) {
                        LOGGER.warn("Encountered invalid kind for a listing (" + kindData + "), skipping it.");
    
                    } else {
                        things.add(thing);
                    }
                    
                }
                
            }
            
            // Finally return list of submissions 
            return things;
        
        } catch (ParseException pe) {
            throw new RedditParseException(pe);
        }
        
    }
Parse JSON received from reddit into a list of things.
This parser expects the JSON to be of a listing of things, and supports
the following things: <i>More</i>, <i>Comment</i>, <i>Submission</i>, and <i>Subreddit</i>.<br>
<br>
<i>Note: if it encounters an invalid element (e.g. missing kind or data), it will
log a warning using SLF4J and would return null.</i>

@param jsonText JSON Text
@param listingName Name of the listing name within the data

@return Parsed list of things

@throws ParseException