Fix JSON parser function

This commit is contained in:
coolneng 2021-01-10 19:53:09 +01:00
parent c61932d99d
commit 2cb004c6d0
Signed by: coolneng
GPG Key ID: 9893DA236405AF57
1 changed files with 6 additions and 3 deletions

View File

@ -45,10 +45,13 @@ public class Indexer {
JSONArray parseJSONFile(String filePath) throws IOException, ParseException {
InputStream jsonFile = getClass().getResourceAsStream(filePath);
JSONArray parseJSONFile(File file) throws IOException {
InputStream jsonFile = new FileInputStream(file);
Reader readerJson = new InputStreamReader(jsonFile);
Object fileObjects = JSONValue.parse(readerJson);
JSONArray arrayObjects = (JSONArray) fileObjects;
return arrayObjects;
Object fileObject = JSONValue.parse(readerJson);
JSONArray arrayObject = new JSONArray();
arrayObject.add(fileObject);
return arrayObject;
}
void openIndex() throws IOException {