Uploaded image for project: 'Spark'
  1. Spark
  2. SPARK-22835

Spark toJSON gives wrong results when there is quote sign in value

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Invalid
    • 2.1.1
    • None
    • SQL
    • None

    Description

      When there is a quote in field value toJSON method gives wrong results.

      >>> spark.range(1).selectExpr('concat("\\"", id, "\\"") as c').toJSON().collect()
      ['{"c":"\\"0\\""}']
      

      The result is not a valid json.
      https://jsonlint.com/

      Attachments

        Activity

          People

            Unassigned Unassigned
            maver1ck Maciej BryƄski
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: