             let gcm = GCM(iv: nonce, mode: .combined)
             let aes = try AES(key: key, blockMode: gcm, padding: .noPadding)
             let plainText = try aes.decrypt(cipherText)
+
+            let decryptedData = try JSONSerialization.jsonObject(with: Data(plainText)) as! [String: Any]
             
-            return String(bytes: plainText, encoding: .utf8)!
+            return decryptedData
         } catch {
-            return "FAILED TO DECRYPT: \(error)"
+            os_log("%{public}@", log: OSLog(subsystem: "com.tautulli.tautulliRemote", category: "OneSignalNotificationServiceExtension"), type: OSLogType.debug, "FAILED TO DECRYPT: \(error)")
+            return ["ERROR": error]
         }
     }
 }

        return serverInfoDict
    }
    
    private func getUnencryptedMessage(deviceToken: String, salt: String, nonce: String, cipherText: String) -> String {
        let password: Array<UInt8> = Array(deviceToken.utf8)
        let salt: Array<UInt8> = Array(Data(base64Encoded: salt)!.bytes)
        let nonce: Array<UInt8> = Array(Data(base64Encoded: nonce)!.bytes)

                let serverInfoDict = getServerInfo(serverId: serverId)
                let deviceToken = serverInfoDict["deviceToken"]! as String
                
                let encrypted = data["encrypted"] as! Int
                var jsonMessage: [String: Any] = [:]
                
                if encrypted == 1 {
                    let salt = data["salt"] as! String
                    let nonce = data["nonce"] as! String
                    let cipherText = data["cipher_text"] as! String
                    jsonMessage = getUnencryptedMessage(deviceToken: deviceToken, salt: salt, nonce: nonce, cipherText: cipherText)
                } else {
                    jsonMessage = data["plain_text"] as! [String: Any]
                }
                
                bestAttemptContent.body = jsonMessage["body"] as! String
                bestAttemptContent.title = jsonMessage["subject"] as! String
                
                // let notificationType = jsonMessage["notification_type"] as! Int
                
                // if notificationType != 0 {
                //     var connectionAddress: String?
                //     if serverInfoDict["primaryActive"]! == "1" {
                //         connectionAddress = serverInfoDict["primaryConnectionAddress"]!
                //     } else {
                //         connectionAddress = serverInfoDict["secondaryConnectionAddress"]!
                //     }
                    
                //     let urlString = "\(connectionAddress!)/api/v2?apikey=\(deviceToken)&cmd=pms_image_proxy&app=true&img=\(jsonMessage["poster_thumb"]!)&width=1080"
                //     os_log("%{public}@", log: OSLog(subsystem: "com.tautulli.tautulliRemote", category: "OneSignalNotificationServiceExtension"), type: OSLogType.debug, "URL STRING: \(urlString)")
                // }

            }
            
            OneSignal.didReceiveNotificationExtensionRequest(self.receivedRequest, with: self.bestAttemptContent, withContentHandler: self.contentHandler)
            contentHandler(bestAttemptContent)
        }
    }
