Hia,
Does anyone have suggestions for parsing GraphQL formatted JSON into something I can use in a dropdown list?
I’ve so far been using REST APIs and the modeler-ui
app but could learn how to add custom java to a docker container if need be?
e.g:
{
"data": {
"allUsers": [
{
"id": "ck1d2h7ug042o01789cc2p88f",
"name": "hahahaahah"
},
{
...,
}
]
}
}
I am also interested in parsing json with flowable expression language.
Is there any example ?
My crude approach so far has been to use some simple Groovy commands in a script task:
execution.setVariable("id", response.id);
execution.setVariable("name", response.name);
where response is the result of the HTTP (REST) task saved as a process variable. This only works for boxed JSON such as:
{
"id": ["ck1d2h7ug042o01789cc2p88f],
"name": ["hahahaahah],
}
so doesn’t help with the GraphQL format above.
filiphr
December 13, 2019, 8:39am
4
If you are using HTTP task and save the entire response as a variable then this is stored as a Jackson JsonNode
. This means that in order to access the name of the first user you can try using data.allUsers[0].name
(this is not tested)