Skip to main content
The 2024 Developer Survey results are live! See the results

All Questions

Tagged with
0 votes
1 answer
2k views

How to use OPENJSON Method with nested JSON having undetermined/dynamic path?

I'm working with an API that spits out a data in the form of dynamic json i.e. the location of some elements of json objects is not fixed, this leads to the path some elements in json arrays being ...
Walter's user avatar
  • 79
4 votes
1 answer
3k views

How do I get the "key" of an array item in OPENJSON, when using WITH?

I want to parse a json-array in my sql-server. I would like to use OPENJSON with WITH to parse specific values into columns. How can I get the index of each array item? I know, that this works fine ...
slartidan's user avatar
  • 21.3k
2 votes
1 answer
2k views

Access JSON_VALUE from SQL Column containing JSON String with Arrays

Looking to use JSON_VALUE to access some data within a JSON column in an SQL Server table. I have a table (tblMyTable) that has the following columns and data; | Column1 | JSONColumn | | -------- ...
CapnComic's user avatar
-1 votes
1 answer
506 views

SQL JSON_VALUE query but without path names?

I have json data that I am trying to import in to a SQL Server database but it doesnt have path names to reference - how do I go by indentifying the different elements here: Sample json: https://api....
optionone's user avatar
0 votes
1 answer
2k views

How to parse a json string to flat rows in SQL Server?

I have data like below in a file which I read into a variable in SQL Server: { "TypeCode": [ { "DestinationValue": "Private", "SourceValue": &...
user avatar
0 votes
1 answer
2k views

how to add key-value pair in json root node and convert it into table using SQL server

I have table people and it's maintain Four column which is Name ,TagName ,Value , Location. I want to convert the tagname and value in json with name and location column as rootnode (Name & ...
Namrata Waghotkar's user avatar
0 votes
1 answer
3k views

Select Json Object as nvarchar(max) in JSON_VALUE

I do not know how to extract a path of JSON as nvarchar(max). It always returns null. I do not want to specify the fields to get because I have no idea the field names. So the idea here is select it ...
Hieu Le's user avatar
  • 1,102
0 votes
1 answer
1k views

How can I improve SQL performance on this Json Array?

In my SQL Server 2016+, I have a table with a json column, the json column has this format: { "$type": "Sample.Product, Sample", "Name": "sample", "Id": "12345", "Policies": { ...
Dongdong's user avatar
  • 2,388
0 votes
1 answer
588 views

How to query a value from json array type column from a table in sql server?

I have a table with a single row of data which has a nvarchar(MAX) type column, lets name the column as json_column and the values of the column are like below: { "data": [ { "name": "...
Karthik's user avatar
  • 729