I am using SparkPost to display a list of exercises that have been sent to a client. The aim is to create a HTML string that can be sent to the API as substitution_data.
An example of the data I need to split down is:
[{
"exerciseName": "4 Point Kneeling Lumbar",
"Params": [{
"param": "Sets",
"childParam": "1"
}, {
"param": "Reps",
"childParam": "1"
}]
}, {
"exerciseName": "Side Flexion",
"Params": [{
"param": "Sets",
"childParam": "1"
}, {
"param": "Reps",
"childParam": "1"
}]
}]
I need to create a string like this:
<ul>
<li>4 Point Kneeling Lumbar, Sets: 1, Reps: 10</li>
<li>Side Flexion, Sets: 1, Reps: 12</li>
</ul>
i.e
var subData = '<ul><li>4 Point Kneeling Lumbar, Sets: 1, Reps: 10</li><li>Side Flexion, Sets: 1, Reps: 12</li></ul>';
I have created a CodePen that shows the first level (exercise Name) however I am unsure how to access the params and display in the desired structure.