Do not die on binary output with json logging

If you try to output some binary data in your tests, `json_encode` will throw an exception even if test is completely valid.

This patch fixes that behaviour.