Fix encoding issue while generate the json