我正在尝试将以下 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条经验 获得超12个赞
这是因为您有额外的嵌套级别:
type Message struct { DbId map[string]interface{} `json:"dbId"`}
dbId
属性的值是map
任何东西的一个string
。
- 1 回答
- 0 关注
- 76 浏览
添加回答
举报
0/150
提交
取消