The Data Couldn't Be Read Because It Isn't in The Correct Format?

后端 未结 2 1765
一整个雨季
一整个雨季 2021-01-27 13:10

I\'m pretty sure my model is correct based on my data, I cannot figure out why I am getting the format error?

JSON:

{
   "1596193200":{
      &qu         


        
2条回答
  •  南方客
    南方客 (楼主)
    2021-01-27 13:48

    From the code you provided it looks like you are trying to decode an Array, but in the JSON the data is formatted as a Dictionary.

    You should try:

    let call = try JsonDecoder().decode(Dictionary.self, from: data)
    

提交回复
热议问题