Answers for "jackson object to json"

-2

convert json to object jackson

ObjectMapper objectMapper = new ObjectMapper();

String carJson =
    "{ \"brand\" : \"Mercedes\", \"doors\" : 5 }";

try {
    Car car = objectMapper.readValue(carJson, Car.class);

    System.out.println("car brand = " + car.getBrand());
    System.out.println("car doors = " + car.getDoors());
} catch (IOException e) {
    e.printStackTrace();
}
Posted by: Guest on June-22-2020
-1

jackson object to json

ObjectMapper objectMapper = new ObjectMapper();
Car car = new Car("yellow", "renault");
objectMapper.writeValueAsString(car);
Posted by: Guest on October-01-2020
-2

jackson object to json

val objectMapper = ObjectMapper()
val car = Car("yellow", "renault")
objectMapper.writeValueAsString(car)
Posted by: Guest on October-01-2020

Code answers related to "jackson object to json"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language