Get length of json array in SQL Server 2016
Using a table instead of a variable:
SELECT count(priceLineLists.RoomTypeId)
FROM Mytable
CROSS APPLY OPENJSON (JsonDataCol, N'$.BasePriceLineList')
WITH (
RoomTypeId int)
AS priceLineLists
The hypothetical SQL statement:
SELECT JSON_ARRLEN(JsonDataCol, '$.BasePriceline') FROM MyTable
Can be done by the actual statement:
SELECT (SELECT COUNT(*) FROM OPENJSON(JsonDataCol, '$.BasePriceline')) FROM MyTable