I'm new to json and objectMapper in Java, and I have a class with two fields, and I want to create json of this class, but I only get using the mapper the attributes. How can I do this?
public class Car{
String a;
String b;
}
ObjectMapper mapper;
String car = mapper.writeValueAsString(new Car(a, b));
the json:
"{a: a, b: b}"
what I want: {Car: { a: a, b: b } }