I have a class like:
class Car {
private Engine engine;
private String color;
private int maxspeed;
}
and Engine class like
class Engine {
private String fueltype;
private String enginetype;
}
I want to convert the Car object to JSON using Jackson with structure like
'car': {
'color': 'red',
'maxspeed': '200',
'fueltype': 'diesel',
'enginetype': 'four-stroke'
}
How can I do that?