Filter / exists condition yields JSON parsing error


I’m using the Twitter integration, and I’m querying for some particular tweets.
I then apply a Filter to the tweets returned, to check only tweets that contain an image.
I use an Exists condition to only continue the workflow if that condition is met.
In the case of my image, I check that the following key exists:


But I’m getting the following error:

Unexpected token h in JSON at position 0

The value in that key is just a string.
And since it’s a link to an image stored on Twitter, it’s a string containing a URL, which of course starts with an h.
For example, a value in that field is:

Does the filter assume that the key’s value needs to be some JSON object or array? So it’s not possible to check for the existence of a value?

I haven’t been able to find the documentation on Filter to better understand how to create my exist condition. If you can point me at the right direction, I’d be grateful.
Thanks in advance for your help.

Hi @glaforge ,

First off, welcome to the Pipedream community. Happy to have you!

You’re understanding the Filter action correctly, but just one tidbit that might solve the issue for you.

The path won’t always exist, because not all tweets have images.

Before the data is passed into the Filter, make sure you’re safely accessing that data:


Now, if the array doesn’t exist at all, instead of throwing an exception, the result will return undefined which the Filter should be able to handle.

Hope this helps!