'Is it possible to get all the paths of json strings stored in an SQL column
Say I have a JSON data stored in a varchar(max) column in a database. Is it possible to use SQL to get all the JSON paths present in that data. For example for the following JSON:
{
"dog":
{
"name":"Rover",
"age": 6,
"likes:["catch", "eating"]
}
}
I would get the output of:
$.
$.dog
$.dog.name
$.dog.age
$.dog.likes[0]
$.dog.likes[1]
I have looked at functions including json_query and json_value but they seem to be more about getting data from the JSON rather than the metadata I require.
I am using SQL Server 2018.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
