encoding objects within a JSON request in Swift
<p>Using Swift 2.0, compiling for IOS 9.2, running Xcode 7.2 on El Capitan</p>

<p>I need to convert this JSON data into a data With JSONObject. </p>

<pre><code>{
    "path": "/Prime_Numbers.txt",
    "settings": {
      "requested_visibility": "public"
    }
}
</code></pre>

<p>I'v been using something like this which worked well, until I got node within a node.</p>

<pre><code>let nodeA:NSDictionary? = ["path":"/Prime_Numbers.txt"]
**let nodeB:NSDictionary? = ["requested_visibility":"public"]**
**nodeA?.setValue(nodeB, forKey: "settings")**
do {
  let jsonData = try NSJSONSerialization.dataWithJSONObject(nodeA!, options: [])
} catch {
    print("footer")
}
</code></pre>

<p>So exclude lines with ** and it works, include them and it will crash....</p>