import Foundation import UIKit
struct OnedriveItemsData: Decodable {
let value : [Value]
}
struct Value: Decodable {
let name: String
let @microsoft.graph.downloadUrl:String
}
Here @microsoft.graph.downloadUrl cannot be declared and giving error beacuse it starts with @
CodePudding user response:
First give a name of the property like downloadUrl
. To match it with server response add the property to CodingKeys
enum. For more information please check this.
struct Value: Decodable {
let name: String
let downloadUrl: String
private enum CodingKeys: String, CodingKey {
case name
case downloadUrl = "@microsoft.graph.downloadUrl"
}
}