Spray-json None values are always converted to null. How to change this?
See original GitHub issueSpray converts None
values to null
only when NullOptions trait is added but by default it doesn’t add those fields to JSON.
When using kebs implicitly[RootJsonFormat[xxx]], it converts None
values to null
. Example of such case: https://scastie.scala-lang.org/myDisconnect/tgnMaqh4QcCdQWDBWQZT5A/7 see f4 field (this is also visible in Kebs tests)
Is it possible to change this behaviour in Kebs and ignore None values?
Note: This seems to be happening when a case class has more than 22 parameters
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Spray-Json: serialize None as null - scala - Stack Overflow
1 Answer 1 ; case class Response(result: Int, error: Option[String]) ; implicit val responseFormat = jsonFormat2( ; import ResponseProtocol._ ; 42 ...
Read more >spray/spray-json: A lightweight, clean and simple ... - GitHub
A lightweight, clean and simple JSON implementation in Scala - GitHub ... spray-json will always read missing optional members as well as null...
Read more >how to handle null value in spray-json? - Google Groups
It comes done with Null value handling. Here is an example of the Wine json format: { "id": 13, "name": "ARGIANO NON CONFUNDITUR",...
Read more >Implicit resolution in Scala: an example with spray-json
From the “ambiguous implicit values” error message, we can understand that the compiler has two ways of implicitly generating a JsonWriter[List] ...
Read more >spray.json.JsObject Scala Example - ProgramCreek.com
This page shows Scala examples of spray.json.JsObject. ... JsonError \/ (String, JsValue) = field.value match { case None ... Is always false for...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@myDisconnect FYI: the new release is already available on Maven Central
@myDisconnect We will try to get it released this week.