我是 Go 的新手。我一直在尝试使用他们的 API从 Flickr 获取照片,但我在解析 JSON 响应时遇到了问题。我一直在用 Go 编写服务器来处理 Web 服务调用。我的输出看起来像这样:{ "photos": { "page": 1, "pages": 3583, "perpage": 100, "total": "358260", "photo": [ { "id": "18929318980", "owner": "125299498@N04", "secret": "505225f721", "server": "469", "farm": 1, "title": "❤️🐾 Puppy Dog Eyes🐾❤️ #Cute #baby #havanese #puppy #love #petsofinstagram #akc #aplacetolovedogs #all_little_puppies #americankennelclub #beautiful #bestanimal #puppies #cutestdogever #dog #doglife #doglover #dogoftheday", "ispublic": 1, "isfriend": 0, "isfamily": 0 }, { "id": "18930020399", "owner": "125421155@N06", "secret": "449f493ebc", "server": "496", "farm": 1, "title": "Titt tei hvem er du for en liten tass 😊 Osvald og King 💜 #cat#kitten #bordercollie #puppy#dog", "ispublic": 1, "isfriend": 0, "isfamily": 0 }, { "id": "18929979989", "owner": "131975470@N02", "secret": "7da344edcb", "server": "498", "farm": 1, "title": "Shame, Shame", "ispublic": 1, "isfriend": 0, "isfamily": 0 } ] }, "stat": "ok"}当我尝试运行代码时,它显示:cannot use jsonData.Photos.Photo[i].Id (type int) as type []byte in argument to w.Write
1 回答
- 1 回答
- 0 关注
- 180 浏览
添加回答
举报
0/150
提交
取消