Re-indented Json processing to 3 spaces issue #39
This commit is contained in:
parent
b17a689341
commit
b0a3b95d70
1 changed files with 24 additions and 24 deletions
|
@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Reference in a new issue