Fixed the API to properly encode results in an array