When I run this I get an error how do I take into consideration that the value could be null and it not throw a error ?
declare @Concepts varchar(500)
set @Concepts = '{"Concepts":null}';
select [value] from openjson(@Concepts,'strict $.Concepts')
when it is not null
set @Concepts = '{"Concepts": [4324,2342]}';
This is the error I am getting
Value referenced by JSON path is not an array or object and cannot be opened with OPENJSON.
X = NULL
instead doX IS NULL
andX IS NOT NULL
instead).Concepts
supposed to be when it's notnull
? The correct answer depends on whether it's another JSON object or a scalar value.