Skip to content
Advertisement

JSON column parse in SQL

one of the columns in my database contains an imported JSON file.

Format of JSON:

There are hundreds of objects with taskId (3271012,3261201,…) how can i parse this tasks from one column to multiple rows?

expected output:

enter image description here

Advertisement

Answer

First you can get all the “data” items as key-value pairs with OPENJSON and then extract the values of interest

The same for the table tbl(id,jsonstr)

db<>fiddle

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement