Skip to content
Advertisement

SQL Query to get the count of Json Array

I have the below Json object. How do I get the count of Object Array.

I tried the below query but seems JSON_Length was not available.

The expected output should be

Advertisement

Answer

If you have valid JSON (at the moment you have a trailing comma (,_ after one of your closing braces (})), then you could use OPENJSON and COUNT:

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement