Can you show the code perhaps ? It might be a good idea to send only the data you need, and not a complete model (Which is very rarely needed)
Sporadic Unable to JSON encode payload. Error code: 5 errors
Hello,
Since a few weeks I have seen repeated but very sporadic Unable to JSON encode payload. Error code: 5 errors in my logs.
This happens when I add a notification to Laravel Queue.
I understand that this happens when the models passed to the notification can not be properly JSON enoded, and that it might be linked to bad character encoding.
However whenever I try to say trigger the notifiction from Artisan Tinker, I don't have any problems (yes, with the exact same data).
I have no idea how I can debug / log things to identify the source of this issue. Any input would be greatly appreciated!
Current setup:
- Laravel v9.25.1
- Horizon v5.10.0
I think I have a lead, the data passed to the notification "seems" fine, but there actually is a non-breakable space in one of the fields of the model...
Say hello to U+200b: https://www.fileformat.info/info/unicode/char/200b/index.htm
Now I just need to find a way to strip all those nasty characters from all input.
Please or to participate in this conversation.