1ObjectMapper objectMapper = new ObjectMapper();
2
3String carJson =
4 "{ \"brand\" : \"Mercedes\", \"doors\" : 5 }";
5
6try {
7 Car car = objectMapper.readValue(carJson, Car.class);
8
9 System.out.println("car brand = " + car.getBrand());
10 System.out.println("car doors = " + car.getDoors());
11} catch (IOException e) {
12 e.printStackTrace();
13}
14
1val objectMapper = ObjectMapper()
2val car = Car("yellow", "renault")
3objectMapper.writeValueAsString(car)