JSON

Data type and usages

Description

Represents JSON, a lightweight data-interchange format. For more information please refer to BigQuery JSON data typearrow-up-right.

circle-info

JSON data type is not supported in Snowflake, currently transformed to VARIANTarrow-up-right.

Sample Source Patterns

JSON Literals

JSON 'json_formatted_data'

For more information please refer to JSON Literals in BigQueryarrow-up-right.

These literals are not supported in Snowflake, but instead the PARSE_JSONarrow-up-right function can be used to convert the input expression to a json type. The only point to take into consideration is that this function cannot be used in the values clause in Snowflake, for this reason it is transformed to a subquery.

Sample Source

CREATE OR REPLACE TABLE test.jsonType
(
  COL1 JSON
);

INSERT INTO test.jsonType
VALUES
  (JSON'{"name": "John", "age": 30, "city": "New York"}'), 
  (JSON'{"name": "Alice", "age": 28, "city": "San Francisco"}');  
  
SELECT JSON'{"name": "John", "age": 30, "city": "New York"}';

Last updated

Was this helpful?