JSON Compatibility with the VECTOR Data Type

The JSON data type supports the VECTOR type as a JSON scalar type. A VECTOR instance is convertible to a JSON type instance and vice versa using the JSON constructor and the VECTOR constructor, respectively.

Note that when converting a JSON array to a VECTOR type instance, the numbers in the JSON array do not have to be of the same numeric type. The input data types do not change the default numeric type for the vector and the VECTOR constructor includes an argument to set the format. Using the VECTOR constructor (or TO_VECTOR) with a JSON data type instance will succeed as long as there is no conversion error.

The following SQL/JSON functions and item methods are compatible for use with the VECTOR data type:

  • JSON_VALUE
  • JSON_OBJECT
  • JSON_ARRAY
  • JSON_TABLE
  • JSON_SCALAR
  • JSON_TRANSFORM
  • JSON_SERIALIZE
  • type()
  • .vector()
  • .string()
  • .stringify()

See Also: