I'm trying to transform
{"namespace": "glmm.data",
"type": "record",
"name": "glmmobs",
"fields": [
{"name": "uid", "type": "int"},
{"name": "user", "type": "string"},
{"name": "job", "type": "string"},
{"name": "fb1_a", "type": "float"},
{"name": "fb1_b", "type": "float"},
{"name": "fb2_a", "type": "int"},
{"name": "fb2_b", "type": "int"},
{"name": "fb2_c", "type": "string"}
]
}
into
{"namespace": "glmm.data",
"type": "record",
"name": "glmmobs",
"fields": [
{"name": "uid", "type": "int"},
{"name": "user", "type": "string"},
{"name": "job", "type": "string"},
{"name": "fb1", "type": "record",
"fields": [ {"name": "fb1_a", "type": "float"},
{"name": "fb1_b", "type": "float"}]
},
{"name": "fb2", "type": "record",
"fields": [ {"name": "fb2_a", "type": "int"},
{"name": "fb2_b", "type": "int"},
{"name": "fb2_c", "type": "string"}]
}
]
}
By using the following spec, I'm able to get close to what I want but not quite..
[
{
"operation": "shift",
"spec": {
"namespace": "namespace",
"type": "type",
"name": "name",
"fields": {
"0": "&1[0]",
"1": "&1[1]",
"2": "&1[2]",
"3": "&1[3].fb1[0]",
"4": "&1[3].fb1[1]",
"5": "&1[4].fb2[0]",
"6": "&1[4].fb2[1]",
"7": "&1[4].fb2[2]"
}
}
}
]
>>>
{
"namespace": "glmm.data",
"type": "record",
"name": "glmmobs",
"fields": [
{"name": "uid","type": "int"},
{"name": "user","type": "string"},
{"name": "job","type": "string"},
{"fb1": [{"name": "fb1_a","type": "float"},
{"name": "fb1_b","type": "float"}]
}, {
"fb2": [{"name": "fb2_a","type": "int"},
{"name": "fb2_b","type": "int"},
{"name": "fb2_c","type": "string"}]
}]
}
Can somebody please help? (An additional nice to have is not having to hardcode the "fb1", "fb2" etc.)
Thanks in advance..
Rao