何らかの理由でunderscore.jsを使用してこのjsonから名前を取得しようとすると、結果を確認できません。私はunderscore.jsテンプレートである程度の成功を収めましたが、このようなjsonからは成功していません。
<script type="text/html" id='usageList'>
<table cellspacing='0' cellpadding='0' border='1'>
<thead>
<tr>
<th>Id</th>
<th>Name</th>
</tr>
</thead>
<tbody>
<% _.each(deals,function(item,key,list){ %>
<% var f = item.Name; %><!-- create more variables -->
<tr>
<!-- use variables -->
<td><%= key %></td>
<td class="<%= f %>"><%= item.name %> </td>
</tr>
<% }); %>
</tbody>
</table>
</script>
<div id="target"></div>
<script>
var deals = {
"results" : [
{
"geometry" : {
"location" : {
"lat" : 35.2521950,
"lng" : -120.6917010
}
},
"icon" : "http://maps.gstatic.com/mapfiles/place_api/icons/shopping-71.png",
"id" : "a60236447e99ae2b2fd0cde9b912f7abd91f4e1d",
"name" : "Costco",
"opening_hours" : {
"open_now" : true
},
"price_level" : 2,
"reference" : "CqQBlgAAAJukesLD8HeY7_xb- V51usJ1nVXJjiWVT3DRYVbParEaKTO8881ULz4f2RM8nGKVOHdIdM67oujeVWFA0YW63_ySzH8O9zTPPwT7h8MijD0BsKnue1BUb_eYHvIp4bCREitCI-b7LIJP_a4UzCrxzT8UsW28KYIParQKJJNfnDMXVvM2ymsvWiRGA42qre6Rhkn7DWkuGyG3zvgZ3xKLz1wSEGl0gCL7B5GNwBSRBytKgmwaFIh1TU7nJCMMsBj04tlA87HHh3Y3",
"types" : [
"department_store",
"health",
"gas_station",
"grocery_or_supermarket",
"food",
"store",
"establishment"
],
"vicinity" : "1540 Froom Ranch Way, San Luis Obispo"
}
]
};
var template = $("#usageList").html();
$("#target").html(_.template(template,{deals:results}));
</script>