class DymicObject {
private Object o;app
public DymicObject(Object o) {
this.o = o;
}this
public DymicObject get(String s) {
return new DymicObject(innerget(this.o, s));
}get
public DymicObject get(int s) {
return new DymicObject(innerget(this.o, s));
}io
public Object Value() {
return this.o;
}class
private Object innerget(Object o, Object key) {
if (o instanceof Map) {
return ((Map) o).get(key);
} else if (o instanceof List) {
return ((List) o).get((Integer) key);
}object
throw new RuntimeException("不支持");
}List
// example
String body = message.getBody();im
ObjectMapper objectMapper = new ObjectMapper();co
Object o = objectMapper.readValue(body, Object.class);time
Object value = new DymicObject(o).get("Records").get(0).get("s3").get("bucket").get("name").Value();