I\'m using an API that returns this pretty horrible JSON:
[
\"A string\",
[
\"A string\",
\"A string\",
\"A string\",
\"A string\",
…
]
A possible solution is to use the JSONSerialization, then you might simply dig inside such json, doing so:
import Foundation
let jsonString = "[\"A string\",[\"A string\",\"A string\", \"A string\", \"A string\"]]"
if let jsonData = jsonString.data(using: .utf8) {
if let jsonArray = try JSONSerialization.jsonObject(with: jsonData, options: []) as? [Any] {
jsonArray.forEach {
if let innerArray = $0 as? [Any] {
print(innerArray) // this is the stuff you need
}
}
}
}