[Solved] I get an Swift Decoding error: parsing JSON, found an Array expected a Dictionary? [duplicate]


Your json seems to be an array of Items, and not an object with a property named todoitems, so do this instead:

let decodedData = try decoder.decode([Items].self, from: todoData)
fetchedTitle = decodedData[1].title

Your ToDoData struct can’t be used in this scenario, since your json doesn’t contain a property named todoitems.

0

solved I get an Swift Decoding error: parsing JSON, found an Array expected a Dictionary? [duplicate]