• <%= file['title'] %>
  • <% end %>" />
  • <%= file['title'] %>
  • <% end %>" />
  • <%= file['title'] %>
  • <% end %>"/>

    Docpad - pull data from JSON file

    249 Views Asked by At

    This is my piece of code

    <% for file in @getCollection("tumblrs").toJSON(): %>
    <li>
    <a href="<%= file.url %>"><%= file['title'] %></a>
    </li>
    <% end %>
    

    Here is my dataset

    {
    "blog_name": "weface",
    "id": 861340745,
    "slug": "ssssaaawweeet",
    "type": "text",
    "date": "2010-07-26 13:28:07 GMT",
    "timestamp": 1280150887,
    "state": "published",
    "format": "html",
    "tags": [],
    "highlighted": [],
    "note_count": 0,
    "title": "Ssssaaawweeet!",
    }
    

    How would I go about getting 'title'?

    0

    There are 0 best solutions below