You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Hyukjin Kwon (Jira)" <ji...@apache.org> on 2020/07/28 08:17:00 UTC

[jira] [Resolved] (SPARK-32158) Add JSONOptions to toJSON

     [ https://issues.apache.org/jira/browse/SPARK-32158?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Hyukjin Kwon resolved SPARK-32158.
----------------------------------
    Resolution: Won't Fix

> Add JSONOptions to toJSON
> -------------------------
>
>                 Key: SPARK-32158
>                 URL: https://issues.apache.org/jira/browse/SPARK-32158
>             Project: Spark
>          Issue Type: Improvement
>          Components: SQL
>    Affects Versions: 3.0.0
>            Reporter: German Schiavon Matteo
>            Priority: Minor
>             Fix For: 3.0.1, 3.1.0
>
>
> Actually when calling `toJSON` on a dataFrame with null values, it doesn't print them.
> Basically the same idea than https://issues.apache.org/jira/browse/SPARK-23772.
>  
> {code:java}
> val df = spark.sparkContext.parallelize(Seq("1", "2", null)).toDF("col1")
> df.toJSON -> {"col1":"1"},{"col1":"2"},{}{code}
>  
> After the PR:
> {code:java}
> val result = df.toJSON(Map("ignoreNullFields" -> "false")).collect().mkString(",")
> val expected = """{"col1":"1"},{"col1":"2"},{"col1":null}"""
> {code}
> [~maropu] [~ueshin]
>  
> [https://github.com/apache/spark/pull/28984/]



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org