Playbook containing unsafe variable values breaks after upgrading from ansible 2.10 to ansible 2.12 (from ansible 5)

Looks like this is a bug that has been reported to the project and they are working on a solution:

template (the lookup plugin) through to_nice_json adds double-quote #76443