Note that there are some explanatory texts on larger screens.

plurals
  1. POSaving a Json extraction in Lift
    text
    copied!<p>I'm trying to save data parced with Lifts' Json data extraction and save it to the database(via mapper) but I cannot find where to connect the snippit to the mapper. The code looks like this.</p> <p>Here is a test snippit.</p> <pre><code>package com.testjson.snippet import dispatch._ import net.liftweb.json.JsonParser._ import java.io.{ByteArrayOutputStream} import com.testjson.model.Done class HelloWorld { def howdy = &lt;span&gt;Welcome to hello-lift at {new _root_.java.util.Date}&lt;/span&gt; val http = new Http val bos = new ByteArrayOutputStream val myRequest = new Request("http://testing.com/folder/file.json") val rawdata = http(myRequest &gt;&gt;&gt; bos) val bs = bos.toString val json = parse(bs) implicit val formats = net.liftweb.json.DefaultFormats case class One(sample1: String, sample2: String, sample3: String) case class Two(samplea: String, sampleb: String, samplec: String, sampled: String) case class Three(alpha: Int, beta: Int, charlie: String, delta: String) case class Done(notice: List[One], header: List[Two], data: List[Three]) json.extract[Done] } </code></pre> <p>And here a sample Model.</p> <pre><code>package com.testjson.model import net.liftweb.http.SHtml import net.liftweb.common._ import net.liftweb.mapper._ class Done extends LongKeyedMapper[Done] with IdPK { def getSingleton = Done object sample1 extends MappedPoliteString(this, 12) object sample2 extends MappedPoliteString(this, 12) object sample3 extends MappedPoliteString(this, 56) object samplea extends MappedPoliteString(this, 12) object sampleb extends MappedPoliteString(this, 12) object samplec extends MappedPoliteString(this, 56) object alpha extends MappedPoliteString(this, 56) object beta extends MappedInt(this) object charlie extends MappedInt(this) object delta extends MappedPoliteString(this, 56) } object Done extends Done with LongKeyedMetaMapper[Done] </code></pre> <p>I've looked through my print copy of the book, the updated ebook, and the google group to no avail. I'm just looking for some help or maybe a code example to point me in the right direction.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload