I encode the executioner game and load possible words into my application using json text files. I tried to follow the examples of others on this site, but I am getting errors from Xcode.
I tried the following code based on another answer:
import Foundation
var error: NSError?
let jsonData: NSData =
let jsonDict = NSJSONSerialization.JSONObjectWithData(jsonData, options: nil, error: &error) as NSDictionary
But I got errors on line 4 with jsonDict, which said that "the call can be dropped, but not marked try, but the error is not processed" and "JSONReadingOptions type does not comply with the NilLiteralConvertible protocol".
Here is the JSON file that I would like to parse:
{
"wordList" : {
"difficulty" : "Easy"
"list" : [
"fireplace",
"apple",
"january",
"tooth",
"cookies",
"mysterious",
"essential",
"magenta",
"darling",
"pterodactyl"
]}}
I would like to be able to enter my array of arrays and get the values. Thank you so much for any help!
source
share