个人博客转至:tybai.com

无聊就想打码,打码使我快乐


Fork me on GitHub

scala读取解析json文件

import scala.util.parsing.json.JSON._
import scala.io.Source

object ScalaJsonParse {
  def main(args: Array[String]): Unit = {

    var tt =  Map.empty[String, Any]

    val tree = parseFull(Source.fromFile("/data/result.json").mkString)
    tt = tree match {
      case Some(map: Map[String, Any]) => map
    }
    println(tt.getClass.getSimpleName)

  }
}

得到的结果如下:

HashTrieMap

posted on 2017-04-01 15:42  TTyb  阅读(2786)  评论(0编辑  收藏  举报

导航


不用多久

我就会升职加薪

当上总经理

出任CEO

迎娶白富美

走上人生巅峰

Pulpit rock