parse json using yaql #5595
Unanswered
BrGitHub11
asked this question in
Q&A
Replies: 1 comment
-
|
You should be able to access with something like <% ctx(myvar).fieldname %> if your json you stored was a dictionary with key "fieldname". But the output might be a json string rather than json - e.g. take a look at the result.stdout. so you might need to use the Jinja from_json_string function - e.g. https://docs.stackstorm.com/reference/jinja.html#from-json-string if you need to convert from a string to a json object. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I created a workflow and one of my bash commands returns json. E.g.
{ "g": { "a": "b", "c": "d" }, "e": "f" }I store the output in a variable:
publish: myvar=<% result().stdout %>Now I want to access one of the fields of my json. So something like:
my_a=<% ctx(myvar)XXXX %>I'm not able to figure how to do this. Any help is appreciated.
Beta Was this translation helpful? Give feedback.
All reactions