I have a table where one column is the id of some executed code and the other column is an array of key value pairs of the name of the parameters passed and the values Formatted like this
executionId|params |
200001 |[{"key":"name","value":"john"},{"key":"surname","value":"smith"}]|
where the amount of parameters passed is arbitrary and i want to output it formatted as a table.
I tried with this query
SELECT
t.executionId,
j.*
FROM #tmpTransac t
CROSS APPLY (
SELECT *
FROM OPENJSON(t.[params])
) j
But the output i get is this
executionId|key|value
1992013 0 {"key":"name","value":"john"}
1992013 1 {"key":"surname","value":"smith"}
and i expected something like
executionId| name |surname
1992013 | john |smith