Is it possible to support building dynamic nested json data (objects) in the new-world visual expression builder? May be it’s easier to achieve with nodeJS if not supported for the current PHP model?
This will make the server-connect side very powerful especially for people dealing with various flavours of APIs & GraphQL… This is sort of an extension to this previously implemented feature request - Dynamically replace parts of JSON for server-side API action
Here is my current working use case:
I had to send a nested json payload in my API call (search_query in the below screenshot), the content of this is build dynamically (it’s an elastic search query).
I did achieve this on server-side after extensive exploration in this forum (@George’s hinted here - Send nested JSON with server-side API)
Here is how the dynamic nested json data (search_query in the above api call) is built using set values (expression entered non-visually clicking on the pencil icon):
sort_array = {{[ { "createdDateTime" : $parent.sort_order } ]}}
parent_header = {{ { "bool": { "filter": other_filters, "should": child_filter } } }}
search_query = {{{ "from": 0, "size": 50, "sort": sort_array, "query": parent_header }}}
The above three are perfectly valid expressions, but when I open it with the visual expression builder, it doesn’t support and throws an lexer error.
Sample json output build from the above technique (the query tag in the below is dynamic):
{
"from": 0,
"size": 100,
"sort": [
{
"createdDateTime": "desc"
}
],
"query": {
"bool": {
"filter": [
{
"terms": {
"_id": [
"25443903"
]
}
},
{
"match": {
"type": "department"
}
}
],
"should": {
"has_child": {
"type": "order",
"inner_hits": {
"size": "10",
"sort": [
{
"createdChildTime": "desc"
}
]
},
"query": {
"match_all": {}
}
}
}
}
}
}