Having trouble transforming the JSON below into the desired JSON format using JavaScript.
Current JSON:
{
"furniture": {
"matter": [
{
"matter1": "Matter 1 value"
},
{
"matter2": "Matter 2 value"
},
{
"matter3": "Matter 3 value"
}
],
"suspense": [
{
"suspense1": "suspense 1 value"
},
{
"suspense2": "suspense 2 value"
}
],
"Direct": [
{
"System": "System value"
}
],
"Road": [
{
"Road key 1 ": "Road value "
}
]
}
}
Expected JSON:
{
"furniture": {
"matter": {
"matter1": "Matter 1 value",
"matter2": "Matter 2 value",
"matter3": "Matter 3 value"
},
"suspense": {
"suspense1": "suspense 1 value",
"suspense2": "suspense 2 value"
},
"Direct": {
"System": "System value"
},
"Road": {
"Road key 1 ": "Road value "
}
}
}
Note: The "furniture" key is static in the code above. All other keys and values are dynamically generated.