gpt4 book ai didi

json - 类型不正确。预期 "object"

转载 作者:行者123 更新时间:2023-12-05 09:13:23 28 4
gpt4 key购买 nike

我有这个 json,但 Visual Studio Code 在标题中给了我警告。

[
{
"title": "Book A",
"imageUrl": "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQ6B1bizZf6gt_7vtUZXx0cPf81u07iJf9ZPBMPn5kM_5pyIRnE",
"description": "Cool book!",
"price": "10",
"id": "0.9910457947149673"
},
{
"title": "Book B",
"imageUrl": "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQ6B1bizZf6gt_7vtUZXx0cPf81u07iJf9ZPBMPn5kM_5pyIRnE",
"description": "Nice!",
"price": "12",
"id": "0.3677736742556723"
},
{
"id": "0.2599869075653567",
"title": "Αχίλλιου Πόλης",
"imageUrl": "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAkGBxMSERUTEhIWFhUXGRgZGBgWGBgYHRYZGBsaGB4YGxkYHSggGBolIBgXITEhJSkrLi4uGB8zODMtNygtLisBCgoKDg0OGBAQGi0dHh8rKy0tLSsrLS0tLSsrKy0tKy0rLS0tLS0tLS0tLS0tLS0tLS03LS0tLTcrLTc3NzcrLf/AABEIAOEA4AMBIgACEQEDEQH/xAAcAAACAgMBAQAAAAAAAAAAAAAABQQGAgMHAQj/xABGEAABAwEGBAMEBggFAgcBAAABAAIRAwQFEiExQQZRYXETIpEygbHBBxRCUqHwIzM0YnJz0eEVJILC8RayNURTVIOSoiX/xAAYAQEBAQEBAAAAAAAAAAAAAAAAAQIDBP/EACERAQEAAgIDAAMBAQAAAAAAAAABAhESIQMxQSJRkTIT/9oADAMBAAIRAxEAPwC/IQhUCEIQCELCvWaxpe8hrWiSTsEGaFjTeHAOaZBEgjcHdZIBCEIBCEIBCEIBCEIBCEIBCEIBCEIBCEIBCEIBCEIBKbzv+lQfgdLjEnDEN7k79Ej4r4mdTqOoU3YSMIJGpxbA7Kr2yyP8NgY5jsbnE43VJAxHzZHTJB0SzcR0H6OcO7T8VNpXhSdo9use/wB65lcdpfSfUpOmWhj83NIe06Fpw/hOyd0ra7EQ9hJfu1khw2g4vL26oL2qjx1UqVm/VKAlxaalToxuje52Vmr120qRe4w1jZPQAJHwq9pa+01XsFSucRBc2WsGTW68vis39OuHV5If0bXv4tnNFx81LIdWHT00VwXK7RUF3XnjY4Gk8ycJBAY45j3HNdTa4ESDkcx2KY34vmx1dz6UXxxHRspiqKgGzgwlp6A81sua/aVqzpB5bn5i0gZbTzUy8LEyvTdSqNlrhB/r3XNLJba10Wh9J4L6TgSP3vuuB2OxUtsMMMc5qe11tvFdClU8J7aofsPDJxdRGoUm237TpUxUf",
"description": "A cool book. Everyone should buy it!",
"price": "10"
},
{
"id": "0.8862598606325078",
"title": "xvbxb",
"imageUrl": "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQ6B1bizZf6gt_7vtUZXx0cPf81u07iJf9ZPBMPn5kM_5pyIRnE",
"description": "xvcxv",
"price": "20"
}
]

为什么?

最佳答案

顶级JSON历史上预期是一个对象。不是数组或基元。

在实践中,该规则的执行情况各不相同。 VSCode 提醒您,您没有从最具互操作性的角度看待 JSON。

编辑:有各种定义 JSON 的 RFC,历史上的通常更严格,但现在大多已被取代。

我不知所措,无法找到强制执行“顶级项目是对象”规则的官方 JSON 定义。我怀疑这只是关于浏览器支持和其他解析器的现实,所以它在被适当标准化之前成为了事实上的标准。

例如: rfc4627 rfc7159 rfc8259

关于json - 类型不正确。预期 "object",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56345876/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com