fix TypeError rendering threshold with format=json

naive implementation of fix proposed in #375