COF-C02 · Question #356
Which function unloads data from a relational table to JSON?
The correct answer is B. TO_JSON. TO_JSON is the Snowflake function that converts a VARIANT value (or a structured/semi-structured value) into a JSON-formatted string. When unloading data from a relational table to JSON format, TO_JSON serializes the data into a valid JSON string. TO_VARIANT casts a value to…
Question
Which function unloads data from a relational table to JSON?
Options
- ATO_OBJECT
- BTO_JSON
- CTO_VARIANT
- DOBJECT CONSTRUCT
How the community answered
(22 responses)- B91% (20)
- C5% (1)
- D5% (1)
Explanation
TO_JSON is the Snowflake function that converts a VARIANT value (or a structured/semi-structured value) into a JSON-formatted string. When unloading data from a relational table to JSON format, TO_JSON serializes the data into a valid JSON string. TO_VARIANT casts a value to the VARIANT type (an internal semi-structured type), not a JSON string. OBJECT_CONSTRUCT builds a VARIANT object from key-value pairs but does not produce a JSON string output. TO_OBJECT casts a VARIANT to an object type but is not used for unloading to JSON format.
Topics
Community Discussion
No community discussion yet for this question.