I have json data that looks like this
{
"students":[{"id":"001", "name":"James"},{"id":"002", "name":"Sam"}]
"courses":[{"id":"001", "name":"English"}, {"id":"002", "name":"Maths"}]
"activity_feed":[{"template":"{students:001} registered for {courses:002}"},{"template":"{students:002} dropped {courses:001}"}]
}
What I am trying to do is use the json data to create an activity feed using javascript that will make use of the template field in activity_feed:
James registered for English
Sam dropped Mathematics
What is the best way to substitute the {students} and {courses} field in template with the respective names of the students and the courses?
James registered for English? why using{students:001}?