How do you recommend to trim whitespaces from any value?

I have a webhook that gets JSON.

Somehow, it could be spaces before or after a value, just like that:
" Value"
or
"Value "

How do you recommend to trim any possible white space that are more than 1 at any value in my JSON?

When I using Parse JSON right after the webhook, I get an error “Invalid JSON” which terminates the scenario.

I think it’s better to just fix the generated JSON at it’s source, if you have access to that.

Extra spaces within a value shouldn’t cause it to become invalid, since you can have spaces within a value.

If you can share a link to the JSON, or provide the JSON in your original question I can help take a look.

2 Likes

I have fixed it using trim after I have sent the existing queue to external webhook in which have set the content type into json.
About new data, as well the problem was that they didn’t use content-type headers.
Original data was everything under ‘value’ as json which cause the error.
I succeed transfer all queue and fixed future data.
Thanks

He @GuyL welcome to the community :wave:

I just wanted to jump in and say thank you for sharing your solution with the community. Great to see that you were able to figure this out on your own. :muscle:

FYI:I marked your reply as a solution for any folks searching for similar info in the future. This way, they’ll know where to look and the community will stay neat and tidy :broom:

1 Like