Fix JSON encoding issue