JSON_MODIFY
JSON extract, test, modify or construct
What changes
- Input
- JSON text or values
- Output or change
- scalar, fragment, or constructed JSON
- Return type
- Returns the updated value of expression as properly formatted JSON text.
Syntax at a glance
JSON_MODIFY ( expression , path , newValue )
Work example
Return a JSON document with one path inserted, updated, or removed.
Use a variable for the input and inspect the returned text because JSON_MODIFY does not update a stored row by itself.
Check your work The result is a new JSON string and path mode affects missing-property behavior.
Practice SQL
Open in SQL FlowSELECT JSON_MODIFY(N'{"status":"draft"}', '$.status', 'ready') AS updated_json;
Open Microsoft Learn for full syntax, permissions, and details for your version.