use of com.capgemini.ntc.test.core.exceptions.BFInputDataException in project devonfw-testing by devonfw.
the class JsonReader method readJson.
/**
* Reads JSON file and return it's
*
* @param jsonFile
* @return
*/
public static JSONObject readJson(File jsonFile) {
JSONObject jsonObject = null;
try {
InputStream jsonStream = new FileInputStream(jsonFile);
String genreJson = IOUtils.toString(jsonStream);
try {
jsonObject = new JSONObject(genreJson);
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} catch (IOException e) {
throw new BFInputDataException("Unable to read JSON file: " + jsonFile.getName());
}
return jsonObject;
}
Aggregations