public static ArrayList<Question> parseJson(String str) throws Exception
    {
        ArrayList<Question> qs = new ArrayList<Question>();
        JSONParser parser = new JSONParser();
        
        String[] lines = str.split("\n|\r");
        for(String line : lines)
        {
            Question q = new Question();
            Object obj = parser.parse(line);
            JSONObject jsonObject = (JSONObject) obj;
            
            q.setQuestion((String)jsonObject.get("Question"));
            q.setAnswer((String)jsonObject.get("Answer"));
            q.setDifficulty(Integer.parseInt((String)jsonObject.get("Difficulty")));
            
            String sub = (String)jsonObject.get("Subject");
            if(sub.toUpperCase().contains("MATH"))
                q.setSubject(SubjectType.MATHEMATICS);
            else if(sub.toUpperCase().contains("ENGLISH"))
                q.setSubject(SubjectType.ENGLISH);
            else if(sub.toUpperCase().contains("LITER"))
                q.setSubject(SubjectType.LITERATURE);
            else if(sub.toUpperCase().contains("GEO"))
                q.setSubject(SubjectType.GEOGRAPHY);
            else if(sub.toUpperCase().contains("HISTORY"))
                q.setSubject(SubjectType.HISTORY);
            else if(sub.toUpperCase().contains("COMPUTER"))
                q.setSubject(SubjectType.COMPUTER_SCIENCE);
            else if(sub.toUpperCase().contains("SCIENCE"))
                q.setSubject(SubjectType.SCIENCE);
            else
                q.setSubject(SubjectType.OTHER);
            
            JSONArray msg = (JSONArray) jsonObject.get("Tags");
            Iterator iterator = msg.iterator();
            while (iterator.hasNext())
            {
                q.addTag((String)iterator.next());
            }
            qs.add(q);
            
        }
    return qs;
    }