0

I am trying to replace a template by a JSON object in typescript. I wanna get the value from JSON Object by something like data['customer.name'] but I don't know how to do that. For detail:

Here is my template

Dear {customer.name},
Congratulations on winning a valuable prize {award.prize},
...

And my data is:

let data = {
  "customer":{
    "name": "Allen Wade"
  },
  "award":{
    "prize": "$100.00"
  }
}

So how can i get a customer name by something like data['customer.name'] to replace my template.

Thank you!

0 Answers0