У меня есть файл JSonTrouble файл десериализации JSON через gson
{
"l": {
"default_level": "...",
"impl": "...",
"levels": [
...,
...
]
},
"a": [
{
"format": "...",
"filename": "...",
"rotation": "...",
"ls": [
...,
...
]
}
]
}
Что я пытаюсь сопоставить
public class ABC {
private List<A> aList = new ArrayList<>();
private L lConfig = new L();
// Gettters and Setters for aList and l
public static class L {
String default_level;
String impl;
List<String> levels = new ArrayList<>();
// Gettters and Setters
@Override
public String toString() {
// ...
}
}
public static class A {
String format;
String filename;
String rotation;
List<String> ls = new ArrayList<>();
// Getters and Setters
@Override
public String toString() {
// ...
}
}
}
, который в настоящее время десериализованное по
public static BLAH load(String externalConfigFile) throws IOException {
ABC config = null;
Path path = Paths.get(externalConfigFile);
if (Files.exists(path) || Files.isReadable(path)) {
config = new Gson().fromJson(readFile(externalConfigFile), ABC.class);
}
return config;
}
, который при печать дает мне
A[]
L{default_level='null', impl='null', levels=[]}
Почему материал не установлен?
не должны быть переменная с именем 'L' быть нанесены на карту Gson? – Jacopofar