How can I save and then load a JSON in NSUserDefaults with SwiftyJSON?
<p>in my iOS project I need to save an entire JSON as user data and then reload it on next app launch.
Squashing it into many values and then recreate the JSON is not an option, I just need some serializable way of saving the entire raw JSON.
I tried to convert it to <code>String</code> by doing <code>json.rawString()</code> and recreate it by passing the obtained <code>string</code> to <code>JSON(string)</code>, but it doesn't work.</p>

<p>I'm both astonished by the difficulty of making such a simple thing and by the lack of informations about a thing like this online, so I can not wait to discover how to do that :)</p>

<p>Example:</p>

<pre><code>public func saveJSON(j: JSON) {
    let defaults = NSUserDefaults.standardUserDefaults()
    defaults.setValue(j.rawString()!, forKey: "json")
    // here I save my JSON as a string
}

public func loadJSON() -&gt; JSON {
    let defaults = NSUserDefaults.standardUserDefaults()
    return JSON(defaults.valueForKey("json") as! String))
    // here the returned value doesn't contain a valid JSON
}
</code></pre>