I'm in need where all the keys in an array should be converted to uppercase. User will upload a excel all the worksheets are read into arrays separately eg: check details, ingredients, menu and desserts are different worksheets in excel.
Current JSON:
[
[
"filename",
"details.xlsx"
],
[
"Check Details",
[
{
"Outdated Label": "Outdated Label1",
"Outdated Value": "Outdated Value"
},
{
"Outdated Label": "Outdated Label2",
"Outdated Value": "Outdated Value2"
},
{
"Outdated Label": "Outdated Label3",
"Outdated Value": "Outdated Value3"
},
{
"Outdated Label": "Outdated Label4",
"Outdated Value": "Outdated Value4"
}
]
],
[
"ingredient",
[
{
"ingredient Id": "1",
"ingredient Code": "IG01",
"ingredient Label": "Recipe 1"
},
{
"ingredient Id": "2",
"ingredient Code": "IG02",
"ingredient Label": "Secret Recipe"
},
{
"ingredient Id": "4",
"ingredient Code": "IG04",
"ingredient Label": "Chef special"
},
{
"ingredient Id": "3",
"ingredient Code": "IG03",
"ingredient Label": "Today special"
}
]
],
[
"menu",
[
{
"Item Menu Id": "M01",
"Item": "Pizza"
},
{
"Item Menu Id": "M02",
"Item": "Hotdogs"
},
{
"Item Menu Id": "M03",
"Item": "French Fries"
}
]
],
[
"Desserts",
[
{
"Menu Item Id": "DRT01",
"Item": "Roasted strawberry crumble"
},
{
"Menu Item Id": "DRT01",
"Item": "Apple and butterscotch pie"
}
]
]
]
Expected JSON :
[
[
"filename",
"details.xlsx"
],
[
"Check Details",
[
{
"OUTDATED LABEL": "Outdated Label1",
"OUTDATED VALUE": "Outdated Value"
},
{
"OUTDATED LABEL": "Outdated Label2",
"OUTDATED VALUE": "Outdated Value2"
},
{
"OUTDATED LABEL": "Outdated Label3",
"OUTDATED VALUE": "Outdated Value3"
},
{
"OUTDATED LABEL": "Outdated Label4",
"OUTDATED VALUE": "Outdated Value4"
}
]
],
[
"ingredient",
[
{
"INGREDIENT ID": "1",
"INGREDIENT CODE": "IG01",
"INGREDIENT LABEL": "Recipe 1"
},
{
"INGREDIENT ID": "2",
"INGREDIENT CODE": "IG02",
"INGREDIENT LABEL": "Secret Recipe"
},
{
"INGREDIENT ID": "4",
"INGREDIENT CODE": "IG04",
"INGREDIENT LABEL": "Chef special"
},
{
"INGREDIENT ID": "3",
"INGREDIENT CODE": "IG03",
"INGREDIENT LABEL": "Today special"
}
]
],
[
"menu",
[
{
"ITEM MENU ID": "M01",
"ITEM": "Pizza"
},
{
"ITEM MENU ID": "M02",
"ITEM": "Hotdogs"
},
{
"ITEM MENU ID": "M03",
"ITEM": "French Fries"
}
]
],
[
"Desserts",
[
{
"MENU ITEM ID": "DRT01",
"ITEM": "Roasted strawberry crumble"
},
{
"MENU ITEM ID": "DRT01",
"ITEM": "Apple and butterscotch pie"
}
]
]
]
Note: All the keys are dynamic as it is uploaded from excel it could be anything.