Counting number of elements in json array
Hi,
I am having a bit of trouble trying to find the size of a JSON array (number of elements in JSON array) where the number of elements in this array can be different for each log message.
For example:
Logmessage1:
{transactions:{[A,B,C,D]}}
Logmessage2:
{transactions:{[A,B,C,D,E,F,G]}}
Logmessage3:
{transactions:{[A]}}
I want to get the array for the key 'transactions' and return 4 for Logmessage1, 7 for Logmessage2 and 1 for Logmessage3.
Is there anyway to do this? Any help will be appreciated.
Please sign in to leave a comment.
Comments
3 comments