score:10
Accepted answer
In order to make it work, you need to register DefaultScalaModule with the object mapper:
val mapper = new ObjectMapper()
mapper.registerModule(DefaultScalaModule)
Also, you need to update your case class and provide Jackson with property name to field name binding:
case class Person(@JsonProperty("DP-Name") name: String,
@JsonProperty("DP-Age") age: Int,
@JsonProperty("DP-height") height: Int,
@JsonProperty("DP-weight") weight: Int)
score:1
- The problem is you have not registered
DefaultScalaModule
withObjectMapper
.
lazy val mapper = new ObjectMapper() with ScalaObjectMapper
mapper.registerModule(DefaultScalaModule)
- Please find a working and detailed answer which I have provided using generics here.
Source: stackoverflow.com
Related Query
- Looking for a good example of polymorphic serialization deserialization using jackson with scala
- Using Scala Jackson for JSON deserialization?
- JSON deserialization using Jackson in Scala
- Deserialization of json using jackson in scala
- JSON serialization of Scala enums using Jackson
- Scala Dynamic Parse Json using case class No Manifest available for T
- Using Akka Http and Circe for decoding JSON in Scala
- Serialize List[Any] to/from Json in Scala using Jackson
- Jackson Scala JSON Deserialization to case classes
- Unable to deserialize json array to class object using jackson fasterxml in scala
- Extracting a field from a Json string using jackson mapper in Scala
- Deserialize Scala map field from JSON using Jackson
- Scala ListMap deserialization using jackson
- update json string in scala using jackson
- reading json file using jackson library in scala language
- Custom serialization and deserialization is scala using jackson
- Loading and Parsing JSON with Spark using Scala Jackson library
- iterating json array in scala html file using for loop
- How to create dynamic json using for loop in scala to pass in Gatling post request
- Scala : Select the Jackson JsonNode keys using Regex filter in a json
- How can I iterate through JSON objects even there is error using Scala Jackson
- Creating JSON from mapFields in Scala using Jackson library
- Reading headers from JSON file and setting as tuples for Header in API Call using Play in SCALA
- (Un)marshall JSON with named root for Ember Data using Scala case class on Spray
- How to parse JSON in Scala using standard Scala classes?
- Scala 2.10 + Json serialization and deserialization
- How to load JSON file using Play with Scala
- Write a simple json REST server using spray in scala
- Serializing a scala object into a JSon String using lift-json
- Is anyone using Scala in anger (and what advice for a Java programmer)?
More Query from same tag
- Optimal design of Spark job, and ensuring narrow dependencies on pre-partitioned data
- "Cannot find an implicit ExecutionContext" error in scala.js example app.
- Split strings with separator splited into each characters in Scala
- Mapping POJOs to case classes with immutable lists during deserialisation
- How to save a partitioned parquet file in Spark 2.1?
- Using akka futures and actors for parallelizing a list
- How to ssh with Amonite supplying the password in advance
- Combining files
- Can shapeless Record type be used as a Poly1? - Part 2
- How Spark handle partial output task
- How can I get nested tests to ouput text properly in specs2?
- Install Docker using a Dockerfile
- ETL process in Spark with Scala
- Slick 3.0 bulk insert returning object's order
- pureconfig can't derive case class with many attributes
- Scala: Check for null for List
- Given a Future[T] can I write function with onComplete callback which returns T?
- Is large scala codebase maintainable?
- Shuffling part of an ArrayBuffer in-place
- ZIO and multiple callbacks
- Loading SQLite db to memory in Java using JDBC?
- parsing a text file into groups using Scala
- How to Process array of json column in spark sql dataframe
- Scala - Spark Boost GroupBy Computing for multiple Dimensions
- Using Scala's Swing wrapper, how can I update a panel's contents via foreach with a collection?
- Scala function/method parametrized return type
- Why does a generic type class representing a Tree have A and B types?
- Hazelcast sort IMap (Scala)
- How do I return a String from a for comprehension in Scala?
- Play: stop WebSocket actor in case of failure