如何在结构中定义字典列表

How to define list of dictionaries in a struct

我想载入包含字典列表的JSON,例如

{error: false, "objects": [{"id": 1, "name": "cat"}, {"id": 2, "name": "dog"}, {"id": 3, "name": "fish"}]

这怎么能在

中定义
struct name: Codable, Identifiable  {
}

用于JSON解码器对接收到的数据进行解码。
如何编写结构来定义此数据类型

struct data: Codable {
   let error: Bool
   let objects: [dataObjects]
}

struct dataObjects: Codable {
    let id: Int
    let name: String
}