Hi
I’m using a JSON template in the body of an HTTP block, but some values are changed, causing an error in the block.
so it’s correct, it worked.
when stationCode string has “=” the value changes
how can i solve this problem?
help
Hi
I’m using a JSON template in the body of an HTTP block, but some values are changed, causing an error in the block.
so it’s correct, it worked.
how can i solve this problem?
help
Hey @Jonatas_Liasch,
This is a common issue. What you are seeing is encoding happening on Unicode characters. To escape this, you can use {{jsonEncode working.value.stationCode}}
without the quotes and a jsonEncode
helper.
Here I’ve used a Mutate Node to copy your value to a new spot on the payload. So you can see that this will work
Let me know if this works for you.
Heath
Great to hear!
Let me know if you have any other questions or if you run into any other issues!
hi @Heath
sorry to come back to this topic
I’m having this problem again, I tried to use jsonEncode, but this time it didn’t work
I made a simulation on mutate node
is there any other solution?
Hi @Jonatas_Liasch,
In this case, I would recommend that you use the String Node with the Concatenate method set. This will concatenate both strings together to make 1 string that you can use as the URL of your HTTP request.
Here’s an example:
In this example, I have set https://www.google.com
to the Source Template, and then am concatenating {{data.query}}
to it. This also works if {{data.url}}
is your source template.
If you would like to use the mutate node, you can use triple curly braces. Here’s an example:
Let me know if these options work for you.
Thank you,
Heath
You could also skip out on using the Mutate Node and the String Node and just use the triple curly braces (as outlined in the mutate node example) directly in the HTTP node you have.
Something similar to https://www.google.com/{{{data.query}}}
.
By default, Handlebars performs HTML escaping and some characters, specifically the equal sign, will get escaped. The jsonEncode
helper was adding the \"
because it was creating an escaped string of the JSON value you were passing.
Triple curly braces will provide raw, unescaped, content.
Please let me know if this works for you.
Thank you
Heath
hi @Heath
it worked perfectly
thanks