I’ve a JSON:
<code>[ {
"Type" : "MOBILE_ADJUSTMENT",
"MobileAdjustment" : {
"BidModifier" : 110,
"OperatingSystemType" : "IOS"
},
"DesktopAdjustment" : null,
"SmartTvAdjustment" : null
} ]
</code>
<code>[ {
"Type" : "MOBILE_ADJUSTMENT",
"MobileAdjustment" : {
"BidModifier" : 110,
"OperatingSystemType" : "IOS"
},
"DesktopAdjustment" : null,
"SmartTvAdjustment" : null
} ]
</code>
[ {
"Type" : "MOBILE_ADJUSTMENT",
"MobileAdjustment" : {
"BidModifier" : 110,
"OperatingSystemType" : "IOS"
},
"DesktopAdjustment" : null,
"SmartTvAdjustment" : null
} ]
I want to remove all nulls from it and also stay only Adjustment
field. I tried with:
<code>[
{
"operation": "default",
"spec": {
"*": {
"*": "NULLS"
}
}
},
{
"operation": "shift",
"spec": {
"*": {
"*": {
"NULLS": null,
"*": {
"@1": "&2"
}
}
}
}
},
{
"operation": "default",
"spec": {
"AdGroupId": 1
}
},
{
"operation": "shift",
"spec": {
"*Adjustment": "&",
"AdGroupId": "AdGroupId"
}
}
]
</code>
<code>[
{
"operation": "default",
"spec": {
"*": {
"*": "NULLS"
}
}
},
{
"operation": "shift",
"spec": {
"*": {
"*": {
"NULLS": null,
"*": {
"@1": "&2"
}
}
}
}
},
{
"operation": "default",
"spec": {
"AdGroupId": 1
}
},
{
"operation": "shift",
"spec": {
"*Adjustment": "&",
"AdGroupId": "AdGroupId"
}
}
]
</code>
[
{
"operation": "default",
"spec": {
"*": {
"*": "NULLS"
}
}
},
{
"operation": "shift",
"spec": {
"*": {
"*": {
"NULLS": null,
"*": {
"@1": "&2"
}
}
}
}
},
{
"operation": "default",
"spec": {
"AdGroupId": 1
}
},
{
"operation": "shift",
"spec": {
"*Adjustment": "&",
"AdGroupId": "AdGroupId"
}
}
]
But it returns invalid result:
<code>{
"AdGroupId" : 1,
"MobileAdjustment" : [ {
"BidModifier" : 110,
"OperatingSystemType" : "IOS"
}, {
"BidModifier" : 110,
"OperatingSystemType" : "IOS"
} ]
}
</code>
<code>{
"AdGroupId" : 1,
"MobileAdjustment" : [ {
"BidModifier" : 110,
"OperatingSystemType" : "IOS"
}, {
"BidModifier" : 110,
"OperatingSystemType" : "IOS"
} ]
}
</code>
{
"AdGroupId" : 1,
"MobileAdjustment" : [ {
"BidModifier" : 110,
"OperatingSystemType" : "IOS"
}, {
"BidModifier" : 110,
"OperatingSystemType" : "IOS"
} ]
}
Somehow it builds array with two duplicates. How to fix that?
I expect:
<code>{
"AdGroupId":1,
"MobileAdjustment":[
{
"BidModifier":110,
"OperatingSystemType":"IOS"
}
]
}
</code>
<code>{
"AdGroupId":1,
"MobileAdjustment":[
{
"BidModifier":110,
"OperatingSystemType":"IOS"
}
]
}
</code>
{
"AdGroupId":1,
"MobileAdjustment":[
{
"BidModifier":110,
"OperatingSystemType":"IOS"
}
]
}