I have this code:
[{"database":{"name":"Shop","num_a":60,"num_b":20},"template":{"name":"<h1
class="name"></h1>","cost":"<span class="cost">Price:
$</span>"}}]
I want to make a class or object that will take the JSON above , parse it into 2 arrays; database and template. It then needs to take the data array and add the values of num_a and num_b. It then needs to insert the calculated value of both nums into the cost template after the "Price: $. It also needs to insert the name into the name template. The final step is to combine both html fragments with the data inserted and retu the combined html.
Is the given code correct? Is there a way to make it?
Thanks
