gpt4 book ai didi

json - Grails Json Views "model"键与模型关键字冲突

转载 作者:行者123 更新时间:2023-12-02 15:49:44 25 4
gpt4 key购买 nike

我正在使用 休息API 的个人资料 chalice app 并在我的一个 json View (_event.gson) 中有以下内容:

model {
Event event
}

json g.render(event, [excludes: ['product']]) {
product {
id event.product.id
name event.product.name
model event.product.model
}
}

简而言之,一个产品属于一个事件。默认情况下,我会以 json 形式获取带有 id 的产品 key 。我想为此添加更多字段。

所以我使用了 excludes,这样我就可以定义将出现在详细说明产品的嵌入式 json 文档下的字段。我的目标是将以下内容作为json:
{
"id": 123,
...,
"product": {
"id": 545434,
"name": "Something Cool",
"model": "MZX 1234"
}
}

最后一个字段——模型——没有出现。似乎它与我的 _event.gson 文件的第一行中使用的模型关键字混淆了。有没有办法解决?我尝试在“模型”中添加引号,但它仍然不起作用。

最佳答案

关于json - Grails Json Views "model"键与模型关键字冲突,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41494200/

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