@@ -0,0 +1,2993 @@
+package common;%0A%0Aimport net.sourceforge.htmlunit.corejs.javascript.tools.debugger.SourceProvider;%0Aimport org.json.simple.JSONArray;%0Aimport org.json.simple.JSONObject;%0Aimport org.json.simple.parser.JSONParser;%0A%0Aimport java.io.FileNotFoundException;%0Aimport java.io.FileReader;%0Aimport java.io.IOException;%0Aimport org.json.simple.parser.ParseException;%0A%0A/**%0A * Created with IntelliJ IDEA.%0A * User: jhasmanyquiroz%0A * Date: 12/8/15%0A * Time: 2:42 PM%0A * To change this template use File %7C Settings %7C File Templates.%0A */%0Apublic class JSONReader %7B%0A    private JSONObject jsonObjectMain;%0A%0A    public JSONReader(String filePath) %7B%0A        parseJSON(filePath);%0A    %7D%0A%0A    /**%0A     * Parses the json file into a JSONObject%0A     * @param filePath%0A     */%0A    private void parseJSON (String filePath) %7B%0A        try %7B%0A            FileReader reader = new FileReader(filePath);%0A            JSONParser jsonParser = new JSONParser();%0A            jsonObjectMain = (JSONObject) jsonParser.parse(reader);%0A        %7D catch (ParseException e) %7B%0A            //e.printStackTrace();%0A        %7D catch (FileNotFoundException ex) %7B%0A            //log.error(%22FileNotFoundException when reading the configuration file %22, ex);%0A        %7D catch (IOException ex) %7B%0A            //log.error(%22IOException when reading the configuration file %22, ex);%0A        %7D catch (NullPointerException ex) %7B%0A            //log.error(%22NullPointerException when reading the configuration file %22, ex);%0A        %7D%0A    %7D%0A%0A    /**%0A     * Gets the jsonObject from the jsonArray and then gets a value given the key%0A     * @param objectName%0A     * @param idKey%0A     * @param idValue%0A     * @param key%0A     * @return%0A     */%0A    public String getKeyValue(String objectName, String idKey, String idValue, String key) %7B%0A        JSONObject jsonObject = getJSONObjectFromArrayById(objectName, idKey, idValue);%0A        return getKeyValueFromJSONObject(jsonObject, key);%0A    %7D%0A%0A    public String getKeyValue(String objectName, String idKey, String idValue, String key, String subKey) %7B%0A        JSONObject jsonObject = getJSONObjectFromArrayById(objectName, idKey, idValue);%0A        JSONObject jsonSubObject = (JSONObject)jsonObject.get(key);%0A        return getKeyValueFromJSONObject(jsonSubObject, subKey);%0A    %7D%0A%0A    private String getKeyValueFromJSONObject(JSONObject jsonObject, String key) %7B%0A        return jsonObject.get(key).toString();%0A    %7D%0A%0A    /**%0A     * Gets the jsonObject which key and value matches the given parameters from a jsonArray%0A     * @param objectName%0A     * @param idKey%0A     * @param idValue%0A     * @return%0A     */%0A    private JSONObject getJSONObjectFromArrayById(String objectName, String idKey, String idValue) %7B%0A        JSONObject jsonObject = null;%0A        JSONArray array = (JSONArray) jsonObjectMain.get(objectName);%0A%0A        for(Object object : array) %7B%0A            jsonObject = (JSONObject)object;%0A            if(jsonObject.get(idKey).equals(idValue)) %7B%0A                break;%0A            %7D%0A        %7D%0A        return jsonObject;%0A    %7D%0A%7D

Create the JSONReader file for read a json file