©  Alex Grinberg 2018
Alex GrinbergXML and JSON Recipes for SQL Serverhttps://doi.org/10.1007/978-1-4842-3117-3_10

10. Modifying JSON

Alex Grinberg1 
(1)
Richboro, Pennsylvania, USA
 

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 ...

Get XML and JSON Recipes for SQL Server: A Problem-Solution Approach now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.