Closed irfaan closed 9 years ago
I checked quickly and it appears to come from the require lib. For some reason, it transforms the json array into a json object... I check our API with a curl, and it works with an array. curl \ -H 'Authorization: Bearer YOUR_TOKEN' \ 'https://api.wit.ai/message?v=20150421&q=what%27s%20the%20weather%20in%20Berkeley&context=%7B%22state%22%3A%5B%22yes_or_no%22%2C%22cancel%22%5D%7D'
I've been looking around for a solution, but with no luck. To clarify, you're suggesting that it is the node 'request' library that is transforming the json array into a json object?
Any idea how we might handle this?
@l5t Any chance you can shed some light on this? https://github.com/request/request/issues/1550#issuecomment-95721689
What format is the array being expected in?
Hi @irfaan,
You need to stringify your context before sending it to Wit.ai. I've added some test to give you some example which works: https://github.com/wit-ai/node-wit/commit/fc5a6ea4ff4e4e6c015eee8b1edbe10ef1715f85
Let me know if you have any questions
Thank you, @oliviervaussy!
Wit.js passes:
Returns: