如何解决带数组的 JOLT 转换
在下方寻求有关Jolt 转换的帮助
{
"consents": [
{
"consent-data": [
{
"consent-key": "DOB","consent-value": "02/2006"
}
],"consent-id": "123","consent-indicator": "true","consent-type": "COPPA","resource-id": "456"
},{
"consent-data": [
{
"consent-key": "DOB","consent-id": "567","resource-id": "678"
}
]
}
预期输出:
{
"Consents": [
{
"consentDataResponse": [
{
"consentKey": "DOB","consentValue": "02/2006"
}
],"consentId": "123","consentIndicator": "true","consentType": "COPPA","resourceId": "456"
},{
"consentDataResponse": [
{
"consentKey": "DOB","consentId": "567","resourceId": "678"
}
]
}
使用进行转换:
[
{
"operation": "shift","spec": {
"consents": {
"*": {
"consent-id": "consents[&1].retailerId","consent-indicator": "consents[&1].consentIndicator","consent-type": "consents[&1].consentType","resource-id": "consents[&1].resoureId","consent-data": {
// loop thru the orderItems array
"*": {
"consent-key": "consentDataResponse[&1].consentKey","consent-value": "consentDataResponse[&1].consentValue"
}
}
}
}
}
}
]
当前输出:
{
"consentDataResponse" : [ {
"consentKey" : [ "DOB","DOB1" ],"consentValue" : [ "02/2006","03/2006" ]
} ],"consents" : [ {
"consentIndicator" : "true","consentType" : "COPPA","resoureId" : "22=","retailerId" : "11="
},{
"consentIndicator" : "false","consentType" : "COPPA1","resoureId" : "44=","retailerId" : "33="
} ]
}
注意 - 此处将重复 consents
和 consentDataResponse
,目前我将 consentDataResponse
作为具有合并值的单独对象,但它应该是每个 consents
。你能在这里帮我吗
解决方法
return maxBottom - minTop + y; //The y size of the topmost control.
您几乎做对了,只是在同意数据循环中添加了索引。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。