Created
February 14, 2015 14:46
-
-
Save akhld/3948a5d91d218eaf809d to your computer and use it in GitHub Desktop.
Jackson Parser
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.fasterxml.jackson.databind.ObjectMapper | |
import com.fasterxml.jackson.module.scala.DefaultScalaModule | |
import com.fasterxml.jackson.module.scala.experimental.ScalaObjectMapper | |
/** | |
* Created by akhld on 14/2/15. | |
*/ | |
object Parser { | |
def main(args: Array[String]): Unit ={ | |
val mapper = new ObjectMapper() with ScalaObjectMapper | |
mapper.registerModule(DefaultScalaModule) | |
import scala.io.Source | |
var count = 0 | |
var _map: Map[String, Any] = Map() | |
for(line <- Source.fromFile("d").getLines()) { | |
count = count + 1 | |
_map = mapper.readValue[Map[String,Any]](line) | |
} | |
println(_map) | |
println("Count :" + count) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment