"Invalid JSON encoding" error when POST to app-search document endpoint with non-ASCII unicode character


When I send a POST to the App Search documents endpoint if any of my fields contain non-ascii characters such as smartquotes, emoji, or foreign languages, I receive a “Invalid JSON encoding” error in response even if I set a Content-Type header to application/json; charset=utf-8. Ideally I’d like to submit these as is without using unicode escape sequences so that I am able to include these characters in my searches and I do not have to manually un-escape these sequences when I receive documents from the search endpoints. What is the recommended way to accomplish this?

Below is a minimal reproduction case, with the Swiftype host, engine, and API token that I use removed.

curl -X POST \
  https://<host>/api/as/v1/engines/<engine>/documents \
  -H 'authorization: Bearer <token>' \
  -H 'content-type: application/json; charset=utf-8' \
  -d '[
    "test": "漢字"