You need to supply an userid (or player itself, not sure about this one anymore, but one of those two) as a second argument to determine how it should be filtered.
Also, it doesn’t seem safe to filter the entire encoded JSON string; if an important character gets tagged out it may make the whole string unreadable.
If there are values in the object that need to be filtered, the filter should be applied to them individually before encoding the table.