/scala-simple-JsonParser

simple JsonParser for scala like jackson library (using reflection)

Primary LanguageScala

scala-simple-JsonParser

Introduction

Simple Scala Json Parser using scala reflection.

Features

  • Not good performance. ( jackson library is 3 times faster than this library )
  • json to T.
  • T to json.
  • You can add default Json ++ your extra json. ( override extraJson function )

* It is just for studying reflection. But this library does not have any problems.

How To Use

case class YourCustomClass(param1: Int, param2: String)

//extends Mode
val yourCustomClass = yourCustomClass(0, "5")
YourCustomClass extends SimpleJsonParser

val jsonValue = yourCustomClass.toJson
val objectValue = yourCustomClass.fromJson(jsonValue)

//standalone Mode
val yourCustomClass = yourCustomClass(0, "5")
val jsonValue = SimpleJsonParser.toJson(yourCustomClass)
val objectValue = SimpleJsonParser.fromJson(jsonValue, classOf[yourCustomClass])

Try ( override extra json )

override def extraJson = Json.obj("extraJson" -> 1, ......)

yourCustomClass.toJson