-
-
Save fitomad/f2f60dcadccd912a9a1a3060e2b08f7f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
Corrige el formato del JSON proviniente del API | |
de BiciMAD. | |
Parece que la clave `data` incluye el caracter backslash `\`, | |
al igual que las llaves de apertura `{` y cierre `}` | |
- Parameter data: El stream de datos devuelto por el servicio | |
- Returns: El stream con un formato `JSON` válido | |
*/ | |
private func fixJSONResponse(from data: Data) -> Data? | |
{ | |
guard var jsonResponse = String(data: data, encoding: .utf8) else | |
{ | |
return nil | |
} | |
... | |
return jsonResponse.data(using: .utf8) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment