JSON字段用于确定jolt中另一个JSON字段的值
假设我们对JSON有
{
"payments": [
{
"paymentId": "16493256102836651255",
"amount": 9.26,
"cardType": "DISC",
"transactionType": "PAYPAL"
}
]
}
期望:
{
"payment": [
{
"paymentId": "16493256102836651255",
"payment_type": "MTL",
"transactionType": "REGULAR"
}
]
}
我已经尝试了此规范
[
{
"operation": "shift",
"spec": {
"payments": {
"*": {
"cardType": {
"LAR": {
"#MTL": "payment.[].payment_type"
}
}
}
}
}
}
]
,我有更多条件,如果CardType类型是LAR或TrassActionType是PayPal,则应使用MTL映射 如果卡类型是LAR,我可以获得MTL
Let say we have on JSON
{
"payments": [
{
"paymentId": "16493256102836651255",
"amount": 9.26,
"cardType": "DISC",
"transactionType": "PAYPAL"
}
]
}
expected :
{
"payment": [
{
"paymentId": "16493256102836651255",
"payment_type": "MTL",
"transactionType": "REGULAR"
}
]
}
I already tried with this spec
[
{
"operation": "shift",
"spec": {
"payments": {
"*": {
"cardType": {
"LAR": {
"#MTL": "payment.[].payment_type"
}
}
}
}
}
}
]
I have on more condition that if cardType type is LAR or transactionType is PAYPAL then is should map with MTL
I am able to get the MTL if card type is LAR but need to check if LAR is not card type but transaction type is PAYPAL then also it should so MTL
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
更多
发布评论
评论(1)
您可以将单个条件用作每个每个对象(
cardType
和transactionType
),例如网站上的 demo http://jolt-demo.appspot.com/
You can use individual conditional as objects per each one (
cardType
andtransactionType
) such asthe demo on the site http://jolt-demo.appspot.com/ is