Pass an HTTP request variable in JSON format

When you send JSON  object, then you must convert JSON object to string. For convert JSON  object to string - please use function SON.Stringify


device.Send(['PUT,/api\r\n\HTTP/1.1,' + JSON.Stringify(request) + ',\r\n\r\n']);

error body
contains invalid json - this answer from server. Maybe missed char end of line ',\r\n\r\n'.

Is this article helpful for you?