Forum Discussion
Thanks for the reply @bojanvelevski.
I think the issue may be that expressions are not allowed in the JSON Generator snap? The solution to my problem is easy enough, I’ll just put a mapper snap before my JSON Generator snap and use the “null-safe access” option to fill in the blanks where needed, but I am surprised this isn’t an option in the JSON Generator snap, and I’m also not sure if any expressions are allowed.
See the very basic chain-JSON Generator pipeline that demonstrates the problem. I can’t reference the input object with an $.get(“num”) expression.
Didn’t noticed that we are talking about JSON Generator snap. @viktor_n 's suggestion should work.
@swright your input JSON doesn’t look correct. If you want to reference two variables, they need to be within the same JSON object. For instance, this is an example of an input document to the REST PATCH Snap that would allow referencing
$serviceUrl
and$requestBody
in the Snap settings:[ { "requestBody": { "ExternalIdentifierNumber": "002500012" }, "serviceUrl": "https://" } ]
If you wanted two PATCH requests to be sent (sequentially, to different URLs etc), the input body would look like:
[{ "requestBody": { "ExternalIdentifierNumber": "002500012" }, "serviceUrl": "https://someurl.com" }, { "requestBody": { "ExternalIdentifierNumber": "ABCD" }, "serviceUrl": "https://anotherurl.com" }]
Hi Robin,
I’m having some trouble getting it into that format. I’m using a union and somehow that is the output of the union. The target path of mapper2 is the $requestBody.ExternalIdentifierNumber and mapper3 is the $serviceUrl.:
Thanks,
Scott
@swright A Union will combine two streams of documents into a single stream.
What you want to do is combine the actual document contents themselves (a document in one stream is combined with the content of a document in another stream). To do this, use the Join Snap where the left and right paths resolve to the same constant value e.g.