nerdexam
Snowflake

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…

Data Loading and Unloading

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)
  • B
    91% (20)
  • C
    5% (1)
  • D
    5% (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

#Data Unloading#JSON Functions#Semi-structured Data#TO_JSON Function

Community Discussion

No community discussion yet for this question.

Full COF-C02 Practice