Share feedback, ideas and get community help

Updated last month

HTTP request passing array in body

Hey folks! Hope this will be a stupid question, but how do I apply JSON.parse({my_array_variable}) on this action so what the endpoint would receive would be JSON formatted without the " " around each array object?

Here is the current payload (sometimes more than 1 item):
["{"Link":"/education/online.educationonlinegridofv:showkurzyhistorybr/219902325557220/false/Vzdel$00e1vanie$0020-$0020Moje$0020vzdel$00e1vanie","MaxMinutes":420,"Minutes":5,"PlatnostNBS":"23.11.2027","PlatnostOFV":"20.10.2024","PlatnostOFVDate":"2024-10-20T00:00:00.000Z","PlatnostOFVStatus":"Incomplete","Plnenie":"Splenené","Sektor":"Starobné dôchodkové sporenie","StudyTime":415}"
]
B
F
14 comments
Can you show what you are currently providing as the body?
Sure.

And also attaching how webhook receives the payload.
Attachments
image.png
image.png
It should then be "OFV": {{saveInApi}}
without the quotes
cannot test as there seems to be some new issue where even Set variable stopped working and is not returning any response if array is used and error if non array object is passed (whether I include " " or not in http request):
Attachments
image.png
image.png
Indeed, that bug appeared very recently and a fix was deployed.
Let us know how it goes
Running "OFV":{{API_response}} without quotes does recognize API_Response as an array but it still has each object converted to string. If I was manipulating this array in Script action, I would use JSON.parse(), but how do I use it in API call so endpoint receives object instead of string? If I using it in previous SetVariable block after script runs it would still store it as strings. Using "OFV":{{=JSON.parse({{API_response}})=}} in HTTP request body didn't work.
Attachment
image.png
Undestood about the variables being a string. Question was more about possibility and how to use code/JS expressions like JSON.parse() in HTTP block 🙂
If the answer is there is no way to convert it out of string before sending it off, then that's the answer and I can start looking at different options of how to handle the problem with downstream tool instead
I think if you need to send an entire JSON body with Typebot, you are doing it wrong. I really suggest that you try to get every items in separate variables and then build back yourself the JSON body with clear simple variables
I indeed don't think you can parse a complexe JSON object in the body of the HTTP Request block
okay, thank you
Add a reply
Sign up and join the conversation on Discord