SQL Server › JSON Support in SQL Server

How do you update a specific value within a JSON document stored in a column without replacing the entire JSON text?

Intermediate

Answer

You use the JSON_MODIFY function, specifying the path to the specific property you want to change and its new value, which returns the updated JSON text with just that one value modified, leaving the rest of the JSON document's structure and other values completely untouched.
UPDATE Users
SET ProfileData = JSON_MODIFY(ProfileData, '$.email', 'newemail@example.com')
WHERE UserId = 123;
Real-world example A user account system updates just the email address stored within a user's JSON profile data using JSON_MODIFY, without needing to reconstruct or replace the entire JSON document for such a small, targeted change.

Common follow-ups: Can JSON_MODIFY add a completely new property that did not previously exist?;How do you remove a property from a JSON document entirely?