I have a large payload for a complex (for me 🙂 JOLT transformation spec that gives empty/null values in the end result. Since the input, spec and output are quite big I have provided pastebin links. Hope this is OK.
Input is:
input
JOLT transform spec is:
JOLT spec
Result is:
output
Part that is not as we want is the pim_network part as shown below (the 2 empty asset_id ones, they are caused by null values after the 4th shift operation):
"pim_network" : [ {
"ifindex" : 1,
"ip_address" : "127.0.0.1",
"ip_subnet" : 8,
"description" : "lo",
"mac_address" : "00:00:00:00:00:00",
"asset_id" : ""
}, {
"asset_id" : ""
}, {
"ifindex" : 2,
"ip_address" : "192.168.119.129",
"ip_subnet" : 24,
"description" : "ens33",
"mac_address" : "00:0c:29:02:b8:cd",
"asset_id" : ""
}, {
"asset_id" : ""
}, {
"ifindex" : 3,
"ip_address" : "172.17.0.1",
"ip_subnet" : 16,
"description" : "docker0",
"mac_address" : "02:42:36:ae:50:55",
"asset_id" : ""
}, {
"ifindex" : 4,
"ip_address" : "172.18.0.1",
"ip_subnet" : 16,
"description" : "br-c75ac7c3061d",
"mac_address" : "02:42:aa:97:1e:97",
"asset_id" : ""
} ],
Expected result is that we only have the 4 valid IPv4 entries in the overall result. Hope somebody can assist.
P.S. I know JSON is not 100% properly visually formatted. Unfortunatelty this is what we get as output from the JOLT demo site.