Add json parameter

Closes #2025
Working on changing that already. The problem is that the module `json` is imported at the top and needs to be used.