Error: Filters (JSON) must be valid json - Error passing through JSON to notion filter

Hi Everyone,

Attempting to set-up a JSON filter for the Notion node:

Everything works fine (above) when I copy and paste a JSON string in:

But if that same string is passed from another module:

An error is returned

I thought that the [Object:] when a string was passed through was removed, but perhaps not.

@jan @jon

Hey @pb84, I think you’re running into a peculiarity with the “JSON” fields in n8n here.

Some nodes would seem to expect an actual JSON value while others expect a string from the looks of it :frowning:

For the Notion node specifically, n8n tries to convert a string into JSON, meaning the input data needs to be a string rather than an actual JSON object, otherwise the error you have seen is thrown.

The [Object:... result you are seeing would, however, suggest you are providing a JSON object rather than a string.

So my first suggestion would be to try and stringify your object. So instead of using {{ $node["Convert to List"].json["search"] }}, could you try {{ JSON.stringify($node["Convert to List"].json["search"]) }} and confirm whether this works for you?

1 Like

Thank you so much, another beautiful solution

1 Like