无法在FTL文件中映射jsonRequest属性
我想在FTL文件中映射下面的json文件市场和子市场字段,但当我尝试下面的代码时,它没有映射,有人能帮我吗?我已经2天无法映射它
JsonRequest
{
"ProcessOrderRequest": {
"prevalidationMode": false,
"hbomaxCart": {
"lobType": "HBOMAX",
"losgs": {
"losg_hbomax_1": {
"productCategory": "HBOMAX",
"market":"ABC",
"subMarket":"something"
"lineItems": {
"LINE_ITEM_00": {
"productType": "PRODUCT",
"billingCode": "BASE-DUMMY-201912",
"quantity": 1
},
"LINE_ITEM_01": {
"productType": "PRODUCT",
"billingCode": "BOLT-UNLHBOMAX-201912",
"quantity": 1,
"promotionReferences": [
"PROMO_ID_1"
]
}
}
}
}
}
}
}
.ftl
<#if pojo.hbomaxCart??>
"data":
{
<#list pojo.hbomaxCart.losgs as key, value>
"market" = ${value.market}
</#list>
},
</#if>
解决方案
您需要使用变量的整个路径正确访问该变量。
<#if pojo.hbomaxCart.losgs.losg_hbomax_1.market??>
"market": "${pojo.hbomaxCart.losgs.losg_hbomax_1.market}",
</#if>
或者,您可以将内容赋给变量以便于访问。
<#assign varname = pojo.hbomaxCart.losgs.losg_hbomax_1>
"market": "${varname.market}",
相关文章