Reference/Classes/HttpService
Class

HttpService

since 1.6.9-1-alpha

Provides JSON helpers and the ability to send HTTP requests to external services.

InheritsInstance

Methods

3

#HttpService:JSONEncode(table: table) → string

since 1.6.9-1-alpha

Encodes a Luau table as a JSON string. Arrays (consecutive integer keys starting at 1) are encoded as JSON arrays; string-keyed tables become JSON objects; empty tables encode as [].

Parameters

tabletable

The table to encode.

Errors

  • VMException read failure -- Failed to read backing memory while executing this method.

#HttpService:JSONDecode(input: string) → table

since 1.6.9-1-alpha

Decodes a JSON string into a Luau table. JSON objects become string-keyed tables; JSON arrays become integer-keyed tables. Nested structures are fully supported.

Parameters

inputstring

The JSON string to decode.

Errors

  • VMException read failure -- Failed to read backing memory while executing this method.

#HttpService:RequestAsync(requestOptions: HttpRequestOptions) → HttpResponse

yieldssince 1.6.9-1-alpha

Performs an HTTP request asynchronously, yielding until the response is received. Only http:// and https:// URLs are permitted.

Parameters

requestOptionsHttpRequestOptions

The request configuration.

Errors

  • VMException read failure -- Failed to read backing memory while executing this method.
  • VMException url required -- requestOptions.Url was missing or empty.
  • VMException invalid scheme -- requestOptions.Url did not use the http:// or https:// scheme.