Count items of json string in SQL script (compatibility version 100, no openjson)

167 Views Asked by At

My Json string has couple of items and I can use json_value to get specific items and parse it. But need to know the length of items to iterate.

[  
   {"name":"Ram", "email":"[email protected]"},  
   {"name":"David", "email":"[email protected]"},  
   {"name":"Bob", "email":"[email protected]"}  
]  

For example JSON_VALUE(@myJsonString, N'$[1].email') returns [email protected] but I need to know the length to increment.

Am I doomed to use openjson?

0

There are 0 best solutions below