Custom json encoder for flask responces