How can I read JSON file from disk and store to array in Swift
- by Ezekiel Elin
I want to read a file from Disk in a swift file. It can be a relative or direct path, that doesn't matter. How can I do that?
I've been playing with something like this
let classesData = NSData .dataWithContentsOfMappedFile("path/to/classes.json");
And it finds the file (i.e. doesn't return nil) but I don't know how to manipulate and convert to JSON, the data returned. It isn't in a string format and String() isn't working on it.