R - Serialize R models as JSON
<p>Is there some good R package that can convert prediction models and other complex object to and from JSON? I have linear regression model from this example:</p>

<pre><code>eruption.lm = lm(eruptions ~ waiting, data=faithful) 
newdata = data.frame(waiting=80)
predict(eruption.lm, newdata) 
</code></pre>

<p>I would like to serialize eruption.lm model as JSON store it somewhere or send it to some external system, and later deserialize it and do prediction.
I have tried with <a href="https://cran.r-project.org/web/packages/jsonlite/index.html" rel="noreferrer">jsonlite R package</a>:</p>

<pre><code>json&lt;-serializeJSON(eruption.lm)
lin.model&lt;-unserializeJSON(json)

predict(lin.model, newdata)
</code></pre>

<p>However, jsonlite cannot handle complex objects - deserialized model returns an error in prediction:</p>

<pre><code>Error in eval(expr, envir, enclos) : could not find function "list"
</code></pre>

<p>Is there some better package that can serialize/deserialize objects.</p>