JSON (JavaScript Object Notation) has become a ubiquitous data format for storing and exchanging information. SQL Server 2016 and later versions provide robust support for working with JSON data. This article explores some useful tips and tricks for handling JSON in T-SQL.
Continue readingTag: json
Introduction to the JSON_PATH_EXISTS() Function in SQL Server
From SQL Server 2022 we can use the JSON_PATH_EXISTS()
function to test whether a specified SQL/JSON path exists in the input JSON string.
It’s similar to the JSON_CONTAINS_PATH()
function that’s available in MySQL and MariaDB.
Understanding the JSON_ARRAY() Function in SQL Server
In SQL Server, we can use the JSON_ARRAY()
function to construct JSON array text from zero or more expressions.
The resulting array contains the values we provide as arguments. Providing zero expressions results in an empty array.
Continue readingAn Introduction to the JSON_OBJECT() Function in SQL Server
In SQL Server, we can use the JSON_OBJECT()
function to construct JSON object text from zero or more expressions.
The resulting object contains the key/value pairs that we provide as arguments. Providing zero expressions results in an empty object.
Continue reading2 Functions that Validate JSON Documents against their Schemas in MySQL
MySQL 8.0.17 introduced a couple of functions that allow us to validate JSON documents against their schemas. These are listed below, with examples.
Continue reading4 Functions that Return Information about JSON Values in MySQL
MySQL provides us with a wide range of functions for working with JSON documents. Below are four MySQL functions that we can use to get information about JSON values.
Continue reading3 JSON Utility Functions in MySQL
MySQL provides us with a few utility functions that act on JSON values, or strings that can be parsed as JSON values.
Below are three JSON utility functions that we can use for such tasks.
Continue readingHow to Create a CHECK Constraint Against a JSON Column in MySQL
When we create or modify a table in MySQL, we have the option of applying a CHECK
constraint against one or more columns. This allows us to check the data before it enters the database. Data can only enter the database if it doesn’t violate the rules in our CHECK
constraint.
If the column is a JSON column, we have the option of creating a CHECK
constraint that checks that the JSON document doesn’t violate its JSON schema. To do this, we can include the schema in the CHECK
constraint.
10 Functions and Operators that Search JSON Documents in MySQL
MySQL provides us with a bunch of functions and operators that allow us to search JSON documents for various things, such as specific values, paths, keys, etc.
Here are seven functions and three operators that search JSON documents in MySQL.
Continue reading10 Functions that Modify JSON Values in MySQL
MySQL provides us with a bunch of functions that can modify JSON values. Here are ten functions that we can use to modify JSON values in MySQL.
Continue reading