How to use variable from loop in HTTP Request body

Hi! I need to POST some information to my API. I know than i can do it by HTTP Request.
But i have small problem, i can’t use variable in my body.
It looks exactly like this:
“{”“source”" : ““Value””,““source_id”” : ““Value””,““exampleVarialbleKey”” : ““item(“Subject”)””}"
Item is my for each item.
It must be in JSON format.

Hi @Kamil_Cyrek

Welcome to community

Assign item(“Subject”) to a variable

That variable has to pass in your request

Eg: “{”“source”" : ““Value””,““source_id”” : ““Value””,““exampleVarialbleKey”” : +YourVariable+}"

Hope this works


Hi welcome to the community!

this would be something like this:
"{""source"" : ""Value"",""source_id"" : ""Value"","""+exampleVarialbleKey+""" : ""+item("Subject").ToString+""}"

Thanks for answer, but i doesn’t work :confused:
End of expression expected.

"{""source"" : ""Value"",""source_id"" : ""Value"","""+exampleVarialbleKey+""" : """+item("Subject").ToString+"""}"

1 Like

Finally!! Thank you very mutch!!
If you have time, can you exmplain, why your code work?

to escape a quote char inside a string we double it, but when we want to append a variable in the middle, we need 3 quotes…

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.