Hi there,
I have a payload of data that I am getting from a webhook. The data needs to be decoded and parsed as a json.
Is there currently an app or away to do this within Switch using the current elements? or would this require a script to do this?
Thanks
decodeURIcomponent to json
Re: decodeURIcomponent to json
If the payload is JSON, you can attach it as an opaque dataset and use the JSON pickup app to convert it to XML. That is the short-term solution, but know that the Switch 2022 Spring release has native JSON support. In other words, you will be able to browse in the data structure of a JSON just like you can now in the data structure of an XML.
- magnussandstrom
- Advanced member
- Posts: 362
- Joined: Thu Jul 30, 2020 6:34 pm
- Location: Sweden
- Contact:
Re: decodeURIcomponent to json
Great news!!
Re: decodeURIcomponent to json
Hi @freddyp, that is good news. Unfortunately the payload is of neither xml or json. When I copy the content in to an online JSON URL decoder it converts perfectly to a json. I'm hoping there is an easy way to do this?
Re: decodeURIcomponent to json
In a normal webhook the payload is in the body of a POST and in that case there is no reason to URL encode it, but technically it is possible. Or does the webhook pass the information on the URL string as part of a GET? In that case URL encoding would be required.
So how is the URL-encoded JSON passed to the webhook? Send it to the Webhook element and show us what comes out.
So how is the URL-encoded JSON passed to the webhook? Send it to the Webhook element and show us what comes out.