spark-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mungeol Heo <mungeol....@gmail.com>
Subject JSON lib works differently in spark-shell and IDE like intellij
Date Wed, 05 Apr 2017 09:52:36 GMT
Hello,

I am using "minidev" which is a JSON lib to remove duplicated keys in
JSON object.

--------------------
minidev
--------------------

<dependency>
  <groupId>net.minidev</groupId>
  <artifactId>json-smart</artifactId>
  <version>2.3</version>
</dependency>

--------------------
Test Code
--------------------

import net.minidev.json.parser.JSONParser
val badJson = "{\"keyA\":\"valueA\",\"keyB\":\"valueB\",\"keyA\":\"valueA\"}"
val json = new JSONParser(JSONParser.MODE_PERMISSIVE).parse(badJson.toLowerCase())
println(json)

--------------------

The source code placed above works at IDE like intellij.
But, it gives error at spark-shell

--------------------
Error
--------------------

net.minidev.json.parser.ParseException: Unexpected duplicate key:keya
at position 33.

--------------------

BTW, both IDE and spark-shell using same version of scala which is 2.11.8.
And, of course, same version of "minidev"

Any help will be great.
Thank you.

---------------------------------------------------------------------
To unsubscribe e-mail: user-unsubscribe@spark.apache.org


Mime
View raw message