title: Parsing JSON file with Freddy SDK
body: <p>I'm struggling to get some values in the correct format when parsing a JSON file using the <a href="https://github.com/bignerdranch/Freddy" rel="nofollow noreferrer">Freddy SDK</a>, I'm trying to parse some questions and answers from a quiz with the JSON like so: </p>
  
  <pre><code>  {
        "success":true,
        "quiz":[
                {
                "question":"Which of the following is required by law?",
                "answers":[
                           ["To have your dog microchipped and correct details.", true],
                           ["To have your dog wear a collar and tag with correct contact details.", true],
                           ["To register your dog with the local Dog Warden.", false],
                           ["To pick up after your dog.", true]
                           ],
                "imageFileName":"ChippedDog.jpg"
                }
               ]
    }
  </code></pre>
  
  <p>The trouble I'm having is with getting the answers and their Bool values. My parsing code is:</p>
  
  <pre><code>func createQuestionObjectsFromJSON() -&gt; [Question] {
  
      self.questions = []
      let filePath = Bundle.main.path(forResource: self.fileName, ofType: self.fileType)
      if let data = NSData(contentsOfFile:filePath!) {
          do {
              let json = try JSON(data: data as Data)
              for questionJSON in try json.getArray(at:"quiz") {
  
                  var question = Question()
                  question.text = try questionJSON.getString(at: "question")
                  question.answers = try questionJSON.getArray(at: "answers") as [AnyObject]
                  question.imageFileName = try questionJSON.getString(at: "imageFileName")
                  self.questions?.append(question)
              }
          } catch {
              print("Error parsing questions part of JSON file")
          }
      }
  
      return questions
  
  }
  </code></pre>
  
  <p>but then when I try to access each answer in my cellForRow at I can't.</p>
  
  <p>if call </p>
  
  <p><code>let answer = currentQuestion.answers[indexPath.row]</code></p>
  
  <p>then print it I get </p>
  
  <p><code>[To have your dog microchipped and correct details., true]</code></p>
  
  <p>but the first value isn't a string as it should be and if I call</p>
  
  <p><code>answer[0]</code></p>
  
  <p>i get nil. I'm a little lost and sure there's an easy fix but i just can't see it.</p>
  
  <p>Any help would be great.</p>
  
  <p>Update: Qustion struct:</p>
  
  <p>import UIKit</p>
  
  <pre><code>struct Question {
  
      var text: String!
      var answers: [AnyObject]!
      var imageFileName: String!
  }
  </code></pre>