Say I have a JSON:
{
"name":"my-project",
"projects" : [
{
"project": "core",
"configurations": [
{
"configuration": "compile",
"dependencies" : [
{
"organization": "a11",
"name" : "b11",
"version" : "1.1"
},
{
"organization": "a22",
"name" : "b22",
"version" : "2.2",
"dependencies" : [
{
"organization": "a33",
"name" : "b33",
"version" : "3.3"
}
]
}
]
}
]
}
]
}
How can I use jq
to convert the JSON to:
{
"name":"my-project",
"projects" : [
{
"project": "core",
"configurations": [
{
"configuration": "compile",
"dependencies" : [
{
"dep" : "a11:b11:1.1"
},
{
"dep": "a22:b22:2.2",
"dependencies" : [
{
"dep": "a33:b33:3.3"
}
]
}
]
}
]
}
]
}
With a help of a function, you can do this recursively.