<dependency> <groupId>org.json4s</groupId> <artifactId>json4s-jackson_2.10</artifactId> <version>3.2.10</version> </dependency>
import org.json4s.{Formats, NoTypeHints} import org.json4s.jackson.Serialization import org.json4s.jackson.Serialization.write case class HbaseMsg(tableName: String, rowkey: String, columnFamily: String, column: String) object Tojson { def main(args: Array[String]): Unit = { implicit val formats: AnyRef with Formats = Serialization.formats(NoTypeHints) val hbase = HbaseMsg("userTbale", "efi325v2j3hv5j3v4i214k", "f1", "name") val hbaseStr = write(hbase) val str = hbase.toString() println(hbaseStr) println(str) } }