Trying to read and transform a JSON file where the input file has:
{
"id": “A9”,
"roles": [
{"title": “A”, “type”: “alpha” },
{"title": “B”, “type”: “beta” },
]
},
{
"id": “A10”,
"roles": [
{"title": “D”, “type”: “delta” },
]
},
But requires transformation for a library which expects values at the same level :
{
"roles": [
{"id": “A9”, "title": “A”, “type”: “alpha” },
{"id": “A9”, "title": “B”, “type”: “beta” },
]
},
{
"roles": [
{"id": “A10”, "title": “D”, “type”: “delta” },
]
},
I'm able to read the input with JsonSlurper, but stuck on how to denormalize it.