When working with form outputs, I encountered an object structure that includes field names and a key "value" representing the value. Sometimes, the field itself is another object with its own "value" key. My goal is to extract only the values stored within the "value" keys. Here's an illustration:
Original Object:
{
inputA: 1354,
inputB: "String Value",
inputC: [
{
value: 1,
label: "Value 1"
},
{
value: 2,
label: "Value 2"
},
{
value: 4,
label: "Value 3"
}
],
inputD: {
value: 16,
label: "Value 16"
},
inputE: {
value: 1,
label: "Value 1"
},
inputF: {
subInputA: {
value: "String Value",
label: "Value of Value"
},
subInputB: {
value: 1,
label: "Value 1"
}
}
}
Desired Result:
{
inputA: 1354,
inputB: "String Value",
inputC: [1, 2, 4],
inputD: 16,
inputE: 1,
inputF: {
subInputFA: "String Value",
subInputFB: 1
}
}