json error: Error Domain=NSCocoaErrorDomain Code=3840
<p>I am building a photo browser for Instagram. I don't have any runtime errors or crashes but evidently the logic in my getPath function block needs work because NSError is saying</p>

<blockquote>
  <p>json error: Error Domain=NSCocoaErrorDomain Code=3840 "JSON text did not start with array or object and option to allow fragments not set." UserInfo={NSDebugDescription=JSON text did not start with array or object and option to allow fragments not set.}</p>
</blockquote>

<p>I have checked similar SO questions with the error but they are more json syntax centric and/or discuss array objects to which I don't how they apply to my code.</p>

<p>My do catch seems to be ok but I need help with data acquisition.</p>

<pre><code>func get(path: String) {
    let url = NSURL(string: path)
    lastSearchURL = path

    let session = NSURLSession.sharedSession()
    let task = session.dataTaskWithURL(url!, completionHandler: {data, response, error -&gt; Void in
        print("Task completed")
        if error != nil {
            print(error!.localizedDescription)
        }

        do {
            let jsonResult = try NSJSONSerialization.JSONObjectWithData(data!, options: NSJSONReadingOptions.MutableContainers) as! NSDictionary
            //self.delegate?.didFailToGetMedia?(error!)

                let results: NSArray = jsonResult["data"] as! NSArray
                self.delegate?.didFetchMediaItems?(results)

        } catch let error {
            print("json error: \(error)")
        }

        })

    task.resume()
}
</code></pre>