#HTTP request passing array in body

1 messages · Page 1 of 1 (latest)

burnt crest
#

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:showkurzy__history__br/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}"
]

arctic bear
#

This post has been pushed to the community knowledgebase. Any replies in this thread will be synced to the community site.

ashen summit
#

Can you show what you are currently providing as the body?

burnt crest
#

Sure.

And also attaching how webhook receives the payload.

ashen summit
#

It should then be "OFV": {{saveInApi}}

#

without the quotes

burnt crest
# ashen summit It should then be "OFV": {{saveInApi}}

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):

ashen summit
#

Indeed, that bug appeared very recently and a fix was deployed.

#

Let us know how it goes

burnt crest
# ashen summit 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.

burnt crest
#

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

ashen summit
#

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