fix API encoding issues and update JSON format