Add support for top-level JSON array in payload

Detect if leading character in JSON payload is an array bracket.  If
found, decode payload into an interface{} and then save the results into
payload["root"].  References to payload values would need to reference
the leading, "virtual" root node (i.e. "root.0.name").

Fixes #215
This commit is contained in:
Cameron Moore 2020-07-29 09:49:02 -05:00
parent f692da2465
commit 0e90ccb441
5 changed files with 127 additions and 5 deletions

View file

@ -168,6 +168,22 @@
],
}
},
{
"id": "sendgrid",
"execute-command": "{{ .Hookecho }}",
"command-working-directory": "/",
"response-message": "success",
"trigger-rule": {
"match": {
"type": "value",
"parameter": {
"source": "payload",
"name": "root.0.event"
},
"value": "processed"
}
}
},
{
"id": "plex",
"execute-command": "{{ .Hookecho }}",

View file

@ -97,6 +97,18 @@
name: "app.messages.message.#text"
value: "Hello!!"
- id: sendgrid
execute-command: '{{ .Hookecho }}'
command-working-directory: /
response-message: success
trigger-rule:
match:
type: value
parameter:
source: payload
name: root.0.event
value: processed
- id: plex
trigger-rule:
match: