SQL Server › JSON Support in SQL Server
What is the difference between the JSON_VALUE and JSON_QUERY functions?
BeginnerAnswer
JSON_VALUE extracts a single scalar value, like a string or number, from a JSON document, while JSON_QUERY extracts an entire object or array from within the JSON, letting you pull out either a simple individual value or a more complex nested structure depending on which function you use.
SELECT JSON_VALUE(OrderData, '$.customerName') AS CustomerName,
JSON_QUERY(OrderData, '$.items') AS ItemsArray
FROM Orders;Real-world example An order processing system extracts the customer's name as a simple text value using JSON_VALUE, while extracting the entire list of ordered items as a nested JSON array using JSON_QUERY for further processing.