Skip to content

Instantly share code, notes, and snippets.

@nhooey
Created March 16, 2013 22:33
Show Gist options
  • Save nhooey/5178616 to your computer and use it in GitHub Desktop.
Save nhooey/5178616 to your computer and use it in GitHub Desktop.
json4s serialization error: could not find implicit value for parameter formats: org.json4s.Formats [error] val theJson = org.json4s.native.Serialization.write(Map("key" -> "value"))
package com.shutterstock.searchservice
import org.scalatra.test.scalatest._
import scala.Predef._
import org.scalatest._
import org.json4s.native.JsonMethods._
import org.json4s.native.Serialization.write
import org.json4s.{ DefaultFormats, Formats, ParserUtil }
import org.json4s.JsonDSL._
import org.json4s.JsonAST._
import scala.text._
class SearchServiceSpec extends ScalatraSuite with FunSuite {
addServlet(classOf[SearchService], "/*")
test("simple get") {
get("/") {
status should equal (200)
/*
body should include (compact(DocText(""" {
"key": "value",
"list": [1, 2, 3]
} """)))
*/
val foo: JObject = ("key" -> "value") ~ ("list" -> List(1, 2, 3))
val boo = Map("key" -> "value", "list" -> List(1, 2, 3))
val goo = Map("key" -> "value")
val theJson = org.json4s.native.Serialization.write(Map("key" -> "value"))
body should include (theJson)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment