@ManyToOne協會我有兩類:修改JSON性反應的使用傑克遜和Spring
public class Team {
private Long id;
private String name;
...
}
public class Event {
private Long id;
@ManyToOne
private Team homeTeam;
@ManyToOne
private Team guestTeam;
...
}
控制器:
public @ResponseBody List<Event> getAll() {...
}
現在我有JSON:
[{"id":1,"homeTeam":{"id":2,"name":"Golden State"},"guestTeam":{"id":1,"name":"Philadelphia"},...
我想要什麼:
[{"id":1,"homeTeam":"Golden State","guestTeam":"Philadelphia",...
我怎麼可以指出Jackson只輸出Team的名字而不是完整的Object?
工作正常。謝謝 – Escander 2013-03-03 11:31:54