title: Scalatra JSON guide code not compiling
body: <p>I copied the instructions on the JSON formatting Guide found here: <a href="http://www.scalatra.org/2.2/guides/formats/json.html" rel="nofollow">http://www.scalatra.org/2.2/guides/formats/json.html</a> </p>
  
  <p>Below is MyScalatraServlet.scala file with all of the code I embedded to test out JSON formatting:</p>
  
  <pre><code>package net.example.testapp
  
  import org.scalatra._
  import scalate.ScalateSupport
  
  // JSON-related libraries
  import org.json4s.{DefaultFormats, Formats}
  
  // JSON handling support from Scalatra
  import org.scalatra.json._
  
  class MyScalatraServlet extends TestAppStack with JacksonJsonSupport {
  
    get("/") {
      FlowerData.all
    }
  
  }
  
  // Sets up automatic case class to JSON output serialization, required by
  // the JValueResult trait.
  protected implicit val jsonFormats: Formats = DefaultFormats
  
  case class Flower(slug: String, name: String)
  
  object FlowerData {
  
    /**
     * Some fake flowers data so we can simulate retrievals.
     */
    var all = List(
        Flower("yellow-tulip", "Yellow Tulip"),
        Flower("red-rose", "Red Rose"),
        Flower("black-rose", "Black Rose"))
  }
  </code></pre>
  
  <p>It seems the compiler does not like the following line:</p>
  
  <pre><code>protected implicit val jsonFormats: Formats = DefaultFormats
  </code></pre>
  
  <p>Here's the error message:</p>
  
  <pre><code>[error] /Users/test/test-app/src/main/scala/net/example/testapp/MyScalatraServlet.scala:22: expected start of definition
  [error] protected implicit val jsonFormats: Formats = DefaultFormats
  [error]                    ^
  [error] one error found
  [error] (compile:compile) Compilation failed
  [error] Total time: 2 s, completed Jun 17, 2013 4:04:34 PM
  &gt; 
  </code></pre>