score:0
Try changing your case class to:
case class User(name: Name,gender: String ,age:Option[String])
If age won't always be there, you need to declare it as optional.
In addition, if age is actually an int
in the json when specified like this:
{"name":"sagar","gendar":"male", "age":25}
Then the case class will have to be defined as:
case class User(name: Name,gender: String ,age:Option[Int])
Source: stackoverflow.com
Related Query
- How can we create case class object from json in scala + play framework 2.0
- scala trouble with play framework JSON serialization from case class
- How can I extract values from a String to create a case class instance in Scala
- How to convert case class to JSON in Play framework 2.3.x (Scala)?
- What's the simplest way to pretty-print a Scala case class to JSON in Play Framework 2.1.x?
- How to create OFormat from Format in scala and play framework
- Scala Play framework controller, converting between JSON and case class
- In ScalaPb, How to create a case object and case class extending from the same trait?
- How to create JSON output from a combined group of composite classes with Play framework
- How to convert JSON into Scala class (NOT Case class), and then populate set of case classes from that big class
- How can i call send and accept Json object from angular to backend on play frmaework?
- How to "reads" into a Scala Case Class given a Json object with key names that start with a capital letter
- How can I automatically map JSON to a case class when a field is a scala keyword?
- MongoDB Scala driver. How to update only changed document's fields from the case class object
- Scala play api for JSON - getting Array of some case class from stringified JSON?
- How can i create a dataframe from a complex JSON in string format using Spark scala
- How to use Scala case class from another Object
- How can i convert None field from case class to JSON correctly
- Scala play 2 framework how can I implement a write or format on Json
- JsError while trying to parse JSON file into case class with Play framework API in Scala
- how to create a Form from an object of case class
- Using Akka streams how can I form a composite case class object from two flows?
- How do I "get" a Scala case object from Java?
- Scala 2.10 reflection, how do I extract the field values from a case class, i.e. field list from case class
- How to implement implicit Json Writes of embedded object in Play Framework 2.x
- How to render JSON response in Play framework v2.0 (latest build from GIT)
- Read case class object from string in Scala (something like Haskell's "read" typeclass)
- Can I get a Scala case class definition from an Avro schema definition?
- How to write a Play JSON writes converter for a case class with a single nullable member
- How to pass a class object from Scala to Java?
More Query from same tag
- Spark Context not Serializable?
- How do I match java.lang.Object with Scala pattern matching
- Failure to Bind to a Remote IP Address for Akka Actor System
- How to count new element from stream by using spark-streaming
- AWS ElasticBeanstalk Play Framework 2.8.8 deployment issue with CheckProcfileForJavaApplication
- maxBy() multiple attributes of objects in List()
- Scala Lift - MongoDB return specific fields from query
- SORM: How can I declare foreign keys?
- Tuple parameter declaration and assignment oddity
- Resolve two sbt imports with the same classes
- java.lang.NoSuchFieldError: cypher_parser_version
- type inference in argument list in combination with setter not working
- HazelcastSerializationException with Kryo using Scala
- Play scala - confusing about the result type of Action.async
- Why this erasure warning with member variables declared as a tuple?
- Scala TypeTag to java.lang.reflect.Type
- How to add JUnit to my Eclipse and how to run it?
- Scala - diff two list of case classes by subset of fields
- Is there a concise way to "invert" an Option?
- How do you use map-reduce in scala dataframes when u have 2 fields and second field should be split?
- akka actor model vs java usage in following scenario
- Extend Groupby to include multiply aggregation
- How do you access variables of super class of passed class in Groovy Script Engine?
- Is there a Scala unit test tool that integrates well with Maven?
- Extracting data from RDD in Scala/Spark
- scala.util.parsing.combinator.RegexParsers constructor cannot be instantiated to expected type
- Seq of observable to observable
- Performance slick query one to many
- using apply methods in a Trait in Scala
- Pass null to a method expects Long