Skip to main content

ObjectMapper

Learn ObjectMapper (REST API with Spring MVC, Spring MVC) with worked examples, diagrams and interview questions. Free on JavaSchoolLab.

Fresher Notes ObjectMapper is the central Jackson class: writeValueAsString converts an object to JSON and readValue converts JSON to an object. Thread safe once configured, so share one instance instead of creating a new one per call. In Spring Boot you simply inject the auto-configured bean with @Autowired or constructor injection.

More lessons in REST API with Spring MVC