This simple script helps you prepare the WITH statement part for the OPENJSON() function. For large JSON data it will scan all nodes and build a distinct list of all available elements. You can adjust it for your needs (different nesting level etc.). DECLARE @JSON NVARCHAR(MAX) SET @JSON = N'{…