SnowPro Core Certification — Question 794
A JSON document is stored in the source_column of type VARIANT. The document has an array called elements. The array contains the name key that has a string value.
How can a Snowflake user extract the name from the first element?
Answer options
- A. source_column.elements[1]:name
- B. source_column.elements[0]:name
- C. source_column:elements[1].name
- D. source_column:elements[0].name
Correct answer: D
Explanation
The correct answer is D because it accurately retrieves the name from the first element of the array using the appropriate syntax for accessing JSON data in Snowflake. Option A incorrectly uses an index of 1, which refers to the second element, while options B and C also fail to use the correct syntax for accessing the name key.