All the examples I find are using dictionary types, for example: user: x, book: y
but how can I convert this type of Json which doesn't contain a key?
["1","137","56","56"]
This is of type String?
I tried:
struct Candidate: Decodable {
var S: String?
}
let chainsAllowed = ["1","137","56","56"]
let jsonObjectData = chainsAllowed.data(using: .utf8)!
let candidate = try? JSONDecoder().decode(
Candidate.self,
from: jsonObjectData
)
but I get nil. How can I convert it into an array?
Thanks