Lacking Knowledge - Templating JavaScript Object

I've been trying to figure out how to capture one of the keys further down the path but with little success. I'm able to identify the key by copying the path from the debug results but when I add it to the template node regardless of the format it doesn't produce the the result. Not sure I'm making much sense. Below is an example the flow I'm working on. Any help will be appreciated.

[
    {
        "id": "49f374582343a1c1",
        "type": "inject",
        "z": "068dbd0dd6f5efda",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 220,
        "y": 2680,
        "wires": [
            [
                "d0cd8b20cc109835"
            ]
        ]
    },
    {
        "id": "d0cd8b20cc109835",
        "type": "http request",
        "z": "068dbd0dd6f5efda",
        "name": "weather.gov",
        "method": "GET",
        "ret": "obj",
        "paytoqs": "ignore",
        "url": "https://api.weather.gov/alerts?point=32.861500,-97.278750",
        "tls": "",
        "persist": false,
        "proxy": "",
        "insecureHTTPParser": false,
        "authType": "",
        "senderr": false,
        "headers": [],
        "x": 390,
        "y": 2680,
        "wires": [
            [
                "9e2b8e2697d425b8"
            ]
        ]
    },
    {
        "id": "9e2b8e2697d425b8",
        "type": "json",
        "z": "068dbd0dd6f5efda",
        "name": "",
        "property": "payload",
        "action": "obj",
        "pretty": false,
        "x": 550,
        "y": 2680,
        "wires": [
            [
                "7dbf393e637b03dd"
            ]
        ]
    },
    {
        "id": "c1e156bb3fbd11d4",
        "type": "debug",
        "z": "068dbd0dd6f5efda",
        "name": "debug 11",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "targetType": "full",
        "statusVal": "",
        "statusType": "auto",
        "x": 880,
        "y": 2680,
        "wires": []
    },
    {
        "id": "7dbf393e637b03dd",
        "type": "template",
        "z": "068dbd0dd6f5efda",
        "name": "",
        "field": "payload",
        "fieldType": "msg",
        "format": "handlebars",
        "syntax": "mustache",
        "template": "{{payload.title}} and {{payload.features[0].properties.event}}",
        "output": "str",
        "x": 720,
        "y": 2680,
        "wires": [
            [
                "c1e156bb3fbd11d4"
            ]
        ]
    }
]

It seems bizarre but the template node does not recognise array indices.
Try

{{payload.title}} and {{payload.features.0.properties.event}}

See https://discourse.nodered.org/t/how-to-access-array-element-by-index-in-mustache-in-template-node/26588/3

That was it, not sure how I missed that posting in my search, but it did the trick. Thank you!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.