Monday, 29 May 2017

Extract specific attribute from son with node.js

Good morning. I'm trying to solve a problem with NODE.js. I have a JSON file like this:

{ "AAL": { "name": "Aalborg Airport", "country": "DK", "timeZone": "DK", "latitude": "570535N", "longitude": "0095100E" }, "AAR": { "name": "Aarhus", "country": "DK", "timeZone": "DK", "latitude": "561800N", "longitude": "0103708E" } }

Writing a .pug file in NODE.js I have to extract "AAR" and "AAL". The .pug file receives an array containing JSON "objects". I tried with something like:

extends base.pug

block content div(style="margin-left: 20px; margin-bottom: 20px;")#body h1 titolo_pagina

    ul
        each place in airportsList

            li
                a(href="./airport/:" + place.id) #{place.name}

But with "place.id" I'm not able to obtain what I want.

Can you help me?

Thank you very much.



via Ben

No comments:

Post a Comment