Reputation: 31
Here is the code
{{payment.metadata | json}}
This is what i am gettting
"{\"phoneNumber\":\"4163000477\",\"animalName\":\"Mustang\"}"
How to display the phone number? I have tried accessing it by this {{(payment.metadata | json).phoneNumber}}
Upvotes: 1
Views: 42
Reputation: 1058
When you get this json use JSON.parse(json)
. This method covert string to object. After that you could access to the field.
let example = JSON.parse(YOUR_JSON);
HTML part:
{{ example.phoneNumber }}
Upvotes: 1