Re-indented Json processing to 3 spaces issue #39

This commit is contained in:
law39 2020-05-01 13:07:00 +01:00
parent b17a689341
commit b0a3b95d70

View file

@ -12,34 +12,34 @@ import java.util.LinkedList;
public class JsonProcessing {
public LinkedList<DictionaryEntry> readInJson(File file) {
LinkedList<DictionaryEntry> returnVal = new LinkedList<>();
ObjectMapper objectMapper = new ObjectMapper();
public LinkedList<DictionaryEntry> readInJson(File file) {
LinkedList<DictionaryEntry> returnVal = new LinkedList<>();
ObjectMapper objectMapper = new ObjectMapper();
try {
returnVal.addAll(Arrays.asList(objectMapper.readValue(file, DictionaryEntry[].class)));
} catch (IOException e) {
e.printStackTrace();
}
try {
returnVal.addAll(Arrays.asList(objectMapper.readValue(file, DictionaryEntry[].class)));
} catch (IOException e) {
e.printStackTrace();
}
return returnVal;
}
return returnVal;
}
public void writeOutJson(String directoryAndFile, LinkedList<DictionaryEntry> words) {
ObjectMapper objectMapper = new ObjectMapper();
String JsonString = "";
public void writeOutJson(String directoryAndFile, LinkedList<DictionaryEntry> words) {
ObjectMapper objectMapper = new ObjectMapper();
String JsonString = "";
try {
JsonString = objectMapper.writeValueAsString(words);
} catch (JsonProcessingException e) {
e.printStackTrace();
}
try {
JsonString = objectMapper.writeValueAsString(words);
} catch (JsonProcessingException e) {
e.printStackTrace();
}
try {
Files.writeString(Paths.get(directoryAndFile), JsonString);
} catch (IOException e) {
e.printStackTrace();
}
try {
Files.writeString(Paths.get(directoryAndFile), JsonString);
} catch (IOException e) {
e.printStackTrace();
}
}
}
}