Developers give preferences to JSON as it has clear structure and smaller data size comparing to XML. In this article, we are going to compare JSON vs XML performance.
To do this, I have created a script, which measures the speed of the JSON_VALUE statement and the value() method for XML. For JSON, I have decided to check how the data retrieval of both varchar(max) and nvarchar(max) works. I have created JSON and XML queries similar in the structure. Now, we will try to retrieve different data types (numeric and string data types) from various file parts.