Hey, folks
Trying to figure out a clean way to solve this problem
I have nested json coming in from an SQS queue, and I've been playing with mocking it up with a static file example and filebeat, which I know is not perfect, but has given me a chance to iterate cleanly without impacting the other pieces.
The json looks a bit like this:
{"city": "My town ","comments": "all is well","date":"2023-01-26T00:00:00.000Z","email":"myuser@example.com","firstname":"User ","lastname":"Name"}
There may be syntax errors in the above, because I did mock this up by hand (but not in my actual tests).
Basically, the issue is, the upstream app breaks when it hits extra whitespace characters that lead/trail the fields.
In the example above, city and firstname have extra whitespace, but it could be a number of fields, and the example is not complete.
I would need the pay
load to look like the above, but without those leading/trailing whitespace chars.
Trying to use mutate + strip doesn't work, because the quotes are part of the string, and need to remain that way, so it occurred to me that strip doesn't want to work there because there is no leading or trailing whitespace.
is there a way to hit defined fields and remove the whitespace around the string, but not within?
@Ugo_Sangiorgi - who had helped in slack