我正在使用杰克逊库从 Json 反序列化。我只需要从这个 json 中提取 2 个值,即 c1 和 d1。我已经使用了这段代码...我需要知道克服获取 c1 和 d1 值的正确方法...
我的 json
{"Alpha":{"A":{"B":{"C":{"c1":1234,c2:"abcd"},"D":{"d1":"xyz","d2":5678,"d3":"qwerty"},"E":[{"e1":456,"e2":"mnop"},{"e1":098,"e2":"qrst"}]}}},"X"{"x1":8098}}
ObjectMapper mapper = new ObjectMapper();
mainclass alphaobj = mapper.readValue(new File("C:\\employee.json"), mainclass.class);
System.out.println(alphaobj.A.B.C.getc1());