I need to generate the following JSON payload (shortened) from a table in SQL Server. Please note the dot in the property name. This is a special syntax called OData.
{
"Id" : "A1",
"new_cluster": {
"spark_conf":{
"spark.master":"local[0]",
"spark.databricks.cluster.profile": "singleNode"
}
}
}
I have tried the following T-SQL command:
SELECT @id as ID, @name1 AS [new_cluster.spark_conf.spark.master]
FOR JSON PATH, WITHOUT_ARRAY_WRAPPER
Which obviously results to:
{
"Id" : "A1",
"new_cluster": {
"spark_conf": {
"spark": {
"master": "local[0]"
}
}
}
}
I have already read the full documentation around JSON functionality in SQL Server thoroughly and no where in the documentation escaping dot in property names has been described.