 
     internal func writeStart(settings: RecognitionSettings) {
         guard state != .disconnected else { return }
-        guard let start = try? settings.toJSON().serializeString() else { return }
+        guard let data = try? JSONEncoder().encode(settings) else { return }
+        guard let start = String(data: data, encoding: .utf8) else { return }
         queue.addOperation {
             self.socket.write(string: start)
             self.results = SpeechRecognitionResults()

    }

    internal func websocketDidReceiveMessage(socket: WebSocketClient, text: String) {
        guard let json = try? JSONWrapper(string: text) else {
            return
        }
        if let state = try? json.decode(type: RecognitionState.self) {
            onStateMessage(state: state)
        }
        if let event = try? json.decode(type: SpeechRecognitionEvent.self) {
            onResultsMessage(event: event)
        }
        if let error = try? json.getString(at: "error") {
            onErrorMessage(error: error)
        }
    }


        }
    }

    private func onResultsMessage(results: SpeechRecognitionResults) {
        state = .transcribing
        onResults?(results)
    }

