encode JSON as UTF-8