scala
import com.fasterxml.jackson.module.scala.DefaultScalaModule
import com.fasterxml.jackson.databind.ObjectMapper
case class Person(name: String, age: Int)
object JacksonScalaExample {
def main(args: Array[String]): Unit = {
val person = Person("Alice", 25)
val objectMapper = new ObjectMapper()
objectMapper.registerModule(DefaultScalaModule)
val jsonString = objectMapper.writeValueAsString(person)
}
}