-
Hi, I'm trying to read parameters from json in a workflow template. What I mean :
- name: t-get-prev-year
inputs:
parameters:
- name: year
script:
image: my-python-docker
command: [python]
source: |
import json
import sys
json.dump([{"year": {{inputs.parameters.year}}, "prev-year": ({{inputs.parameters.year}}-1)}], open("/outputdir/years.json", "w"))
outputs:
parameters:
- name: years-json
valueFrom:
path: /outputdir/years.json
- name: select-features
template: t-select-features
withParam: "{{steps.get-prev-year.outputs.parameters.years-json}}"
arguments:
parameters:
- name: year
value: "{{item.year}}"
- name: prev-year
value: "{{item.prev-year}}" It works but then if I want to use the outputs artefact (like with Instead of running my template in a loop to read the json values I tried to use the builtin function Maybe there is something I missunderstood in the jsonpath syntax or another way to read json value that I didn't found. I'm working with |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I believe
With dashes/hyphens and no bracket notation, you would get a parsing error, per the expression docs. |
Beta Was this translation helpful? Give feedback.
I believe
jsonpath
should work here. Per the docs you linked though, dashes in expression syntax can only be used with bracket notation. As in: