I am using Mustache and using the data
{ \"names\": [ {\"name\":\"John\"}, {\"name\":\"Mary\"} ] }
My mustache template is:
If you can control the output of the JSON string, then try this out.
{ "names": [ {"name":"John", "index":"1"}, {"name":"Mary", "index":"2"} ] }
So when you make your JSON string, add the index as another property for each object.