Hi guys I get confused trying to qcheave this, so any help would be great!
I have two arrays from which I need a specific object. Source arrays:
1-Types (1D): ['dev', 'env', 'othr']
2-Services (2D): (3) [Array(3), Array(4), Array(6)]
Array(3)
0: "'1':'Option 11'"
1: "'2':'Option 12'"
2: "'3':'Option 13'"
Array(4)
0: "'5':'Option 21'"
1: "'6':'Option 22'"
2: "'7':'Option 23'"
3: "'4':'Option 24'"
Array(6)
0: "'8':'Option 31'"
1: "'9':'Option 32'"
2: "'10':'Option 33'"
3: "'11':'Option 34'"
4: "'12':'Option 35'"
5: "'13':'Option 36'"
The desired outcome is this structure:
servData = {
"dev": {
"1": "Option 11",
"2": "Option 12",
"3": "Option 13"
},
"env": {
"4": "Option 21",
"5": "Option 22",
"6": "Option 23",
"7": "Option 24"
},
"othr": {
"8": "Option 31",
"9": "Option 32",
"10": "Option 33",
"11": "Option 34",
"12": "Option 35",
"13": "Option 36"
}
};