Hello!
Looking for advise after staring at this problem for half a day.
I have a complex JSON thats returned by an API and I need to create the decode Struct but i'm having difficulties.
I invested in Ducky as I thought that would generate the Struct for me, but the generated code is throwing a whole bunch of errors.
Below is the first 50 lines of the generate Struct. I'm getting the error: Type 'Ab.Result.Action' does not conform to protocol 'Decodable' on line 5 and then on every following Struct line. So i'm assuming that there is a core issue that needs to be fixed but I dont understand what the error means. Below is just a sample this goes of for another 1000 lines.
Also screenshot here:
https://imgur.com/a/wXWNvT3
Any advise greatly appriciated, I was kinda hoping Ducky would be me saviour, but in this case sadly not.
Thank you!!
import Foundation
struct Ab: Codable {
struct Result: Codable {
struct Action: Codable {
struct Criterium: Codable {
var name: String
var relevance: String
var verbose: String
var searchEngine: String?
private enum CodingKeys: String, CodingKey {
case name
case relevance
case verbose
case searchEngine = "search_engine"
}
}
struct Metric: Codable {
struct TotalURL: Codable {
var count: Int
var percentage: Double
var percentageInScope: Double
var previousCount: Any?
var previousPercentageInScope: Any?
var previousPercentage: Any?
private enum CodingKeys: String, CodingKey {
case count
case percentage
case percentageInScope = "percentage_in_scope"
case previousCount = "previous_count"
case previousPercentageInScope = "previous_percentage_in_scope"
case previousPercentage = "previous_percentage"
}
}
struct TotalUrlsInScope: Codable {
var count: Int
var percentage: Double
var previousPercentage: Any?
var previousCount: Any?
private enum CodingKeys: String, CodingKey {
case count
case percentage
case previousPercentage = "previous_percentage"
case previousCount = "previous_count"
}
}