am trying to transform this json input using jolt. please help whats wrong with my spec.
JSON Input
{
"ResultSets": {
"ClassPaths": {
"currentRow": 0,
"fields": [
{
"name": "path"
},
{
"name": "loadOrder"
}
],
"rows": [
[
"/a/b/genenerator.jar",
"-10"
],
[
"/a/b/server.jar",
"0"
]
]
},
"DisabledComponents": {
"currentRow": 0,
"fields": [
{
"name": "name"
},
{
"name": "location"
}
],
"rows": [
[
"ActiveDirectoryLdapComponent",
"/a/b/component.hda"
],
[
"AppAdapterCore",
"/a/b/AdapterCore.hda"
]
]
}
}
}
Expected JSON Output
{
"ResultSets" : {
"ClassPaths" : [ {
"path" : "/a/b/genenerator.jar",
"loadOrder" : "-10"
}, {
"path" : "/a/b/server.jar",
"loadOrder" : "0"
} ],
"DisabledComponents" : [ {
"name" : "ActiveDirectoryLdapComponent",
"location" : "/a/b/component.hda"
}, {
"name" : "AppAdapterCore",
"location" : "/a/b/AdapterCore.hda"
} ]
}
}
My Spec is
[
{
"operation": "shift",
"spec": {
"ResultSets": {
"*": {
"rows": {
"*": {
"*": "ResultSets.&1.@(3,fields[&].name)"
}
}
}
}
}
}
]
if i replace * with the key name(ClassPath or DisabledComponents) it works but gives only json with that key.
I cannot hardcode the key cos its dynamic and we dont know what comes there beforehand.
So i want a spec which works without specifying exact key (ClassPath or DisabledComponents) in the spec.
Please help.
Thanks, Hari