Home:ALL Converter>Return All JSON Values and Attributes with Attributes as Columns in SQL Server 2017

Return All JSON Values and Attributes with Attributes as Columns in SQL Server 2017

Ask Time:2019-04-30T05:27:13         Author:Bink

Json Formatter

Using a simple example of a table with just two columns—an id and a long JSON string—how can I easily return all JSON values and attributes with the attributes as columns?

I know I can readily use JSON_VALUE and specify a specific key/attribute, but I don’t want to have a long list of numerous JSON_VALUE for every possible key. Is there a dynamic way of doing this?

Say, for example, I have 100 JSON keys and the result should be an id column with another 100 key columns and their values?

Thank you.

Author:Bink,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/55911035/return-all-json-values-and-attributes-with-attributes-as-columns-in-sql-server-2
yy