【发布时间】:2022-08-18 15:19:40
【问题描述】:
在场景中,如何为字段 \'location\' 和 \'ID\' 提供 EL$。
我尝试如下给出,但由于未为 \'ID\' 和 \'Location\' 定义属性而出现错误
.body(
StringBody(
\"\"\"{\"name\": \"${name}\", \"Url\": \"${Url}\", “Product”: [ { \"ID\": \"${ID}\", \"location\": \"${location}\" } ] }\"\"\"
)
).asJson
JSON:
[
{
\"name\":\"xyz\",
\"url\":\"test1.com\",
\"Product\":[
{
\"ID\":111111,
\"location\":\"NewYork\"
}
]
},
{
\"name\":\"abc\",
\"url\":\"test2.com\",
\"Product\":[
{
\"ID\":22222,
\"location\":\"Texas\"
}
]
}
]
-
如果您不提供 JSON 的结构,将无法帮助您。
-
下面是 JSON 结构的样子 { \"name\": "xyz", "url\": \"test1.com\", "Product": [ { \"ID\": 111111, \"location\ “: “纽约” } ] }
-
@Stéphane LANDELLE 非常感谢你。我在之前的评论中提供了结构
-
@Stéphane LANDELLE 这是我的 feeder 文件的样子: [ { \"name\": "xyz", "url\": \"test1.com\", "Product": [ { \"ID\": 111111 , \"location\": “NewYork” } ] }, { \"name\": “abc”, “url\": \"test2.com\", “Product”: [ { \"ID\": 22222, \"location\": “Texas” } ] } ] 当我尝试将 $ 用于字符串正文 i 中的 ID 和位置字段时,我遇到了未为 \'ID\' 和 \'Location\' 定义的问题
标签: gatling