jsonscalalift-json

Unable to run simple lift web example


When I attempt to convert to JSON string from List I receive the compile-time error:

'JsonAST.RenderSettings.compact.type' does not take parameters

src:

import net.liftweb.json._
import net.liftweb.json.JsonDSL._
import net.liftweb.json.Extraction._

implicit val formats = net.liftweb.json.DefaultFormats

val json = ("name" -> "joe")

compact(render(json))

Excluding the imports, the above code is copied from https://github.com/lift/framework/tree/master/core/json

Here is the build.sbt entry:

  "net.liftweb" %% "lift-json" % "3.4.1",

How to further debug what my issue is ?


Solution

  • The documentation is not so updated. With liftweb 3.1.0 this has moved from pretty(render()) to prettyRender(). Here is the commit that did it. You can also do compactRender(). Both are part of net.liftweb.json.JsonAST._ You should do:

    val json = ("name" -> "joe")
    println(compactRender(json))
    

    Code run at Scastie.