I have the following JSON file that I would like to parse with jq tool that someone suggested me but I'm new with it. There are 3 parents nodes with the same children names. The parent nodes are MNRs, GNRs and MSNRs and each of them has children named N1, N2, NR_i, NR_f.
{
"Main": {
"Document": "Doc.1",
"Cini": "DDFR",
"List": {
"SubList": {
"CdTa": "ABC",
"NN": "XYZ",
"ND": {
"RiS": {
"RiN": {
"NSE14": {
"MNRs": {
"MRD": [
{
"NR": {
"N1": "393",
"N2": "720",
"SNR": {
"NR_i": "203",
"NR_f": "49994"
}
}
},
{
"NR": {
"N1": "687",
"N2": "345",
"SNR": {
"NR_i": "55005",
"NR_f": "1229996"
}
}
}
]
},
"GNRs": {
"RD": {
"NR": {
"N1": "649",
"N2": "111",
"SNR": {
"NR_i": "55400",
"NR_f": "877"
}
}
}
},
"MSNRs": {
"NR": [
{
"N1": "748",
"N2": "5624",
"SNR": {
"NR_i": "8746",
"NR_f": "7773"
}
},
{
"N1": "124",
"N2": "54",
"SNR": {
"NR_i": "8847",
"NR_f": "5526"
}
}
]
}
},
"NSE12": {
"MBB": "990",
"MRB": "123"
},
"MGE13": {
"TBB": "849",
"TRB": "113"
}
}
}
}
}
}
}
}
With this code I get the following
.Main.List.SubList.ND.RiS.RiN.NSE14.MNRs.MRD
[
{
"NR": {
"N1": "393",
"N2": "720",
"SNR": {
"NR_i": "203",
"NR_f": "49994"
}
}
},
{
"NR": {
"N1": "687",
"N2": "345",
"SNR": {
"NR_i": "55005",
"NR_f": "1229996"
}
}
}
]
And with these commands I get the a columns of individual values for each children and others null.
.. | .N1?
.. | .N2?
.. | .NR_i?
.. | .NR_f?
I'm far from my desired output since I'd like to extract the children for each parent and tabulate in the form below.
+------+------+-------+---------+-----+-----+-------+------+-----+------+------+------+
| MNRs | GNRs | MSNRs |
+------+------+-------+---------+-----+-----+-------+------+-----+------+------+------+
| N1 | N2 | NR_i | NR_f | N1 | N2 | NR_i | NR_f | N1 | N2 | NR_i | NR_f |
+------+------+-------+---------+-----+-----+-------+------+-----+------+------+------+
| 393 | 720 | 203 | 49994 | 649 | 111 | 55400 | 877 | 748 | 5624 | 8746 | 7773 |
+------+------+-------+---------+-----+-----+-------+------+-----+------+------+------+
| 687 | 345 | 55005 | 1229996 | | | | | 124 | 54 | 8847 | 5526 |
+------+------+-------+---------+-----+-----+-------+------+-----+------+------+------+
May someone help me with this. Thanks in advance.