To insert, delete, and update data in a JSON document, SQL Server 2016 introduced the JSON_MODIFY() function that updates a JSON string value. This function, compared to XML modify() method, only has an append mode, as opposed to the insert, delete, and instead of modes provided by the XML method. Chapter 10 “Modifying JSON” will demonstrate many recipes explaining how to update a JSON document. In the final section of this chapter, I will compare the performance between XML and JSON.
10-1. Add ing a New Key-Value Pair to JSON
Problem
You want to add a new key-value pair ...