SingleStore Managed Service

HTTP API Data Type Conversion

SingleStore’s HTTP APIs return JSON objects as responses. The following table maps the SingleStore data types to the corresponding JSON types.

Category

Data Type

JSON Type

Examples

Boolean

  • BOOL

  • TINYINT

Boolean

true

false

Numeric

  • TINYINT

  • SMALLINT

  • MEDIUMINT

  • INT

  • BIGINT

  • FLOAT

  • DOUBLE

Base64-encoded string

"aGVsbG8="

"MQ=="

"MTIz"

JSON

  • JSON

JSON values are directly added to the row tuple without any type conversion, which eliminates the need for additional parsing in later steps.

Note: JSON null values and SQL null values cannot be differentiated when using the HTTP APIs.

{ "hello": "world" }

[ 1, 2, null, 3 ]

"data"

1.4

String

  • DECIMAL

  • GEOGRAPHY

  • GEOGRAPHYPOINT

  • TEXT

  • CHAR

  • VARCHAR

  • TINYTEXT

  • MEDIUMTEXT

String

"first value"

"POINT(-74.04451396 40.68924403)"

"POLYGON((1 1,2 1,2 2, 1 2, 1 1))"

Time and Date

  • YEAR

Number

2001

  • TIME

String

"12:04:00"

  • DATE

String

"2006-01-02"

  • DATETIME

  • TIMESTAMP

String

"2006-01-02 15:04:05"

  • DATETIME(6)

  • TIMESTAMP(6)

String

"2006-01-02 15:04:59.735214"

Important

  • If a column is nullable, make sure to prepare to handle null values.

  • Invalid DATETIME and TIMESTAMP values cannot be used over the HTTP API, although SingleStore allows them without the HTTP proxy.

  • UNSIGNED numbers must be specified as NOT NULL. The HTTP API will fail if it receives a value larger than the maximum SIGNED value and if the result type is NOT NULL.