Skip to content

Read value from json in workflow template without loop #6278

Closed Answered by agilgur5
bmacera asked this question in Q&A
Discussion options

You must be logged in to vote

Instead of running my template in a loop to read the json values I tried to use the builtin function jsonpath without success. I tryed directly value: "{{=jsonpath(steps.get-prev-year.outputs.parameters.years-json, '$.year')}}" and then by passing the json as input {{=jsonpath(inputs.parameters.year-json, '$.year')}}.
I did it based on https://argoproj.github.io/argo-workflows/conditional-artifacts-parameters/#built-in-functions and https://argoproj.github.io/argo-workflows/variables/#examples.

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:

{{=jsonpath(steps['get-prev-year'].outputs.paramete…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by agilgur5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
area/templating Templating with `{{...}}`
2 participants