 
 class FilePersistence: LexisPersistence
 {
-    private let filePath = NSHomeDirectory().appending("/Library/Caches/LexisWords.txt")
+    private let filePath = NSHomeDirectory().appending("/Library/Caches/LexisWords.json")
     
     static let instance = FilePersistence()
     
     private let parallelism = 6
     private let async: OperationQueue
+    private let serializer = BasicJSONSerializer.instance
     
     private init()
     {

    }
    
    
    
    func getAllWords() -> [LexisWord]
    {
        LOG.info("Reading words from file :\(filePath)")
        
        guard let array = NSArray(contentsOfFile: filePath)
        else
        {
            LOG.info("Words not found in file \(filePath)")

        
        let nsArray = NSArray(array: array)
        
        guard let jsonString = serializer.toJSON(object: nsArray)
        else
        {
            LOG.warn("Failed to convert array to JSON")
            throw LexisPersistenceError.ConversionError
        }
        
        LOG.info("Writing \(nsArray.count) words to JSON File: \(filePath)")
        
        do
        {
            try jsonString.write(toFile: filePath, atomically: true, encoding: .utf8)
            LOG.info("Wrote words to JSON file")
        }
        catch
        {
            LOG.error("Failed to write JSON to file \(filePath) : \(error)")
            throw LexisPersistenceError.IOError
        }
    }
    
