Thursday
I'm receiving a payload in a webhook trigger that has section of JSON like:
I'm posting to an API that has an array like this:
I need to pass the datapill API name in ParameterName field and the datapill value in the ParameterValue field. I can't find anything in the documentation to be able to get a datapill API name.
Thursday
You can use .keys to get the keys/API name in a hash. It's not recursive.
character = {
"name": "Frodo Baggins",
"race": "Hobbit",
"age": 50,
"home": "Bag End, the Shire",
"role": "Ring-bearer",
"weapon": "Sting",
"companions": [
"Samwise Gamgee",
"Gandalf",
"Aragorn"
],
"item": {
"name": "The One Ring",
"power": "dominion over all",
"dangerous": true
}
}
character.keys
## output:
## [
## "name",
## "race",
## "age",
## "home",
## "role",
## "weapon",
## "companions",
## "item"
## ]
Thursday
So this has to be done via the raw JSON payload rather than the data pills? I'm currently using the datapills that are returned from the webhook.
Thursday
No, this works on the root data pill as well. If my example was used in a JSON parser action, I could use .keys on the "Document" output data pill.
Thursday
Thanks Gary, I'll check it out!