我正在嘗試將以下 JSON 字符串解組到下面的結構中;{ "io.confluent.connect.avro.ConnectDefault":{ "lastModifiedAt":{ "string":"2022-09-01T02:22:19+00:00" }, "taxRateId":{ "int":5 }, "basedOn":{ "string":"Markup" }, "priceTax":{ "double":2.04 }, "price":{ "int":24 }, "status":{ "string":"active" }, "costPrice":{ "int":24 }, "createdAt":{ "string":"2022-09-01T02:22:19+00:00" }, "productId":{ "int":3545 }, "ownershipId":{ "int":1 }, "dbId":{ "int":3655 }, "markupPercentage":{ "int":0 } }}type Wrapper struct { Message `json:"io.confluent.connect.avro.ConnectDefault"`}type Message struct { DbId Field `json:"dbId"`}type Field struct { Value map[string]interface{}}但它給了我Field地圖的空值。不確定我在這里做錯了什么。JSON去解組
1 回答

蕭十郎
TA貢獻1815條經驗 獲得超13個贊
這是因為您有額外的嵌套級別:
type Message struct { DbId map[string]interface{} `json:"dbId"`}
dbId
屬性的值是map
任何東西的一個string
。
- 1 回答
- 0 關注
- 112 瀏覽
添加回答
舉報
0/150
提交
取消