I'm trying to parse a json file using OPENJSON in Azure sql but I want to do a specific mapping in my new table. I have a json file which looks like this with many y0_1, y0_2, ....y0_380.
{"proto": "01",
"type": "A",
"description": "heartbeat",
"geometry": {"y0_1": {"tag": "Normal",
"probability": 0.40,
"x": 39,
"y": 13},
"y0_2": {"tag": "category_3", "probability": 0.8, "x": 48, "y": 13},
"y0_3": {"tag": "Normal", "probability": 0.9, "x": 27, "y": 10},
"Test": {"proba": 0.65}}}
I want to parse the json and have a table With this format: I tried to parse the json using the Openjson format but I don't know how to get all the y and x in the same column like in the picture in the link
SELECT * from OPENROWSET (
BULK 'sample.json',
DATA_SOURCE ='dataset',
FORMATFILE_DATA_SOURCE = 'myblobstorage',
SINGLE_CLOB
) AS J
CROSS APPLY OPENJSON (BulkColumn)
WITH (
proto nvarchar(100) N'$.proto',
description nvarchar(100) N'$.description',
)