alex_panganiban
5 years agoContributor
Create Key Value Pair Array
Hoping someone can help me out. I have a JSON array. It’s an array of string values and it’s called, washCare. I want to give each value in the array a property name. How would I write the correct mapping to accomplish the following? I thought I could possibly use the map arrow function, but I couldn’t figure out the correct syntax for the expression.
Original Array Format:
“washCare”:
[ “Machine Wash, WARM”, “Hand Wash Only” ]
Desired Result:
“washCare”:
[
{“instruction”: “Machine Wash, WARM”},
{instruction": “Hand Wash Only”}
]