Github user Fokko commented on the issue:

    https://github.com/apache/spark/pull/21596
  
    @gatorsmile Are you completely sure about that? The Spark REST API `null` 
values are always omitted. Where is this behaviour different?
    
    `mapper.setSerializationInclusion(Include.NON_ABSENT)`:
    ```
    scala> println(mapper.writeValueAsString(Map("abc" -> null)))
    {}
    ```
    
    `mapper.setSerializationInclusion(Include.ALWAYS)`:
    ```
    scala> println(mapper.writeValueAsString(Map("abc" -> null)))
    {"abc":null}
    ```
    
    If you're doing proper Scala and try to avoid the `null`'s in general, with 
`None` in combination with 
`mapper.setSerializationInclusion(Include.NON_ABSENT)` you'll get:
    ```
    scala> println(mapper.writeValueAsString(Map("abc" -> None)))
    {"abc":null}
    ``` 
    



---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to